code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
CWE-639
9
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
CWE-89
0
protected function getParentNotExistsService() { return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists(); }
CWE-89
0
public static function go($input, $path, $allowed='', $uniq=false, $size='', $width = '', $height = ''){ $filename = Typo::cleanX($_FILES[$input]['name']); $filename = str_replace(' ', '_', $filename); if(isset($_FILES[$input]) && $_FILES[$input]['error'] == 0){ if($uniq == true)...
CWE-89
0
public static function login() { user::login(expString::sanitize($_POST['username']),expString::sanitize($_POST['password'])); if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in flash('error', gt('Invalid Username / Password')); if (expSession::is_set('redirecturl_error')) { ...
CWE-89
0
static function is_username($username, &$error='') { if (strlen($username)<2) $error = __('Username must have at least two (2) characters'); elseif (!preg_match('/^[\p{L}\d._-]+$/u', $username)) $error = __('Username contains invalid characters'); return $error == '';...
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
} elseif ($type == 'customlayout') { $layoutData = unserialize($data['name']); $className = $layoutData['className']; $layoutName = $layoutData['name']; if ($item['name'] == $layoutName && $item['className'] == $className) { ...
CWE-502
15
public function validateReference() { $docElem = $this->sigNode->ownerDocument->documentElement; if (! $docElem->isSameNode($this->sigNode)) { if ($this->sigNode->parentNode != null) { $this->sigNode->parentNode->removeChild($this->sigNode); } } ...
CWE-347
25
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
function &getAll(&$dbh, $proposalId) { $sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS timestamp FROM package_proposal_votes WHERE pkg_prop_id = ". $dbh->quoteSmart($proposalId) ." ORDER BY timestamp ASC"; $res = $dbh->query($sql); if (DB::isError($res)) { return $res; ...
CWE-640
20
private function filterScheme($scheme) { $scheme = strtolower($scheme); $scheme = rtrim($scheme, ':/'); return $scheme; }
CWE-89
0
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); 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 function pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::ge...
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 function testCompletePurchaseHttpOptions() { $this->setMockHttpResponse('ExpressPurchaseSuccess.txt'); $this->getHttpRequest()->query->replace(array( 'token' => 'GET_TOKEN', 'PayerID' => 'GET_PAYERID', )); $response = $this->gateway->completePurc...
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 function pluginDetails() { return [ 'name' => 'Debugbar', 'description' => 'Debugbar integration for OctoberCMS.', 'author' => 'RainLab', 'icon' => 'icon-cog', 'homepage' => 'https://github.com/rainlab/debugbar-plug...
CWE-532
28
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 putFileInStorage(UploadedFile $uploadedFile) { $attachmentData = file_get_contents($uploadedFile->getRealPath()); $storage = $this->getStorage(); $basePath = 'uploads/files/' . date('Y-m-M') . '/'; $uploadFileName = Str::random(16) . '.' . $uploadedFile->getC...
CWE-22
2
public function actionView($id){ // add media object to user's recent item list User::addRecentItem('m', $id, Yii::app()->user->getId()); $this->render('view', array( 'model' => $this->loadModel($id), )); }
CWE-79
1
public function getMovieData($id){ $getMovie = $this->getMovie($id); $getCast = $this->getCast($id); $getImage = $this->getImage($id); $data = array_merge($getMovie, $getCast); $data = array_merge($data, $getImage); return $data; }
CWE-89
0
function db_case($array) { global $DatabaseType; $counter = 0; if ($DatabaseType == 'mysqli') { $array_count = count($array); $string = " CASE WHEN $array[0] ="; $counter++; $arr_count = count($array); for ($i = 1; $i < $arr_count; $i++) { $value = $array...
CWE-79
1
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); ...
CWE-89
0
public function setHomePage() { if (!$this->request->is('post')) { throw new MethodNotAllowedException(__('This endpoint only aaccepts POST requests.')); } if (empty($this->request->data['path'])) { $this->request->data = array('path' => $this->request->data); ...
CWE-79
1
public function testGetDropdownConnect($params, $expected, $session_params = []) { $this->login(); $bkp_params = []; //set session params if any if (count($session_params)) { foreach ($session_params as $param => $value) { if (isset($_SESSION[$param])) { $...
CWE-639
9
function setup() { $this -> catch_globals(); $this -> version['prior'] = '01'; $this -> version['minor'] = '06'; $this -> version['fix'] = '01'; $this -> version_text = $this -> version['prior']; $this -> version_text .= '.'; $this -> version_text .= $this -> version['minor']; $this -> version_text ...
CWE-89
0
public static function checkIp6($requestIp, $ip) { if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) { throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); } if (false !== strpos($ip...
CWE-89
0
public static function name($id) { $id = sprintf('%d', $id); if(isset($id)){ $cat = Db::result("SELECT `name` FROM `cat` WHERE `id` = '{$id}' LIMIT 1"); //print_r($cat); if(isset($cat['error'])){ return ''; ...
CWE-89
0
function read_cache( $cache_id, $check = false ) { global $cms_db; if ( $cache_id && $this->use_cache ) { if ( !$this->cache_db ) $this->cache_db = new DB_cms; $return = false; $sql = "SELECT val FROM " . $cms_db['db_cache'] . " WHERE name = '"...
CWE-89
0
$t = preg_split('/[ \t]/', trim($enclosure[2]) ); $type = $t[0]; /** * Filters the RSS enclosure HTML link tag for the current post. * * @since 2.2.0 * * @param string $html_link_tag The HTML link tag with a URI and other attributes. */ echo apply_filters( 'rss_enclosure',...
CWE-79
1
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
CWE-79
1
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 setPassword($newPassword, $doHashing = true) { global $gSettingsManager, $gPasswordHashAlgorithm, $gChangeNotification; if (!$doHashing) { if (is_object($gChangeNotification)) { $gChangeNotification->logUserChange( (int) $this->get...
CWE-613
7
public static function verify($gresponse) { new Xaptcha(); $recaptcha = new \ReCaptcha\ReCaptcha(self::$secret); $resp = $recaptcha->verify($gresponse, $_SERVER['REMOTE_ADDR']); if ($resp->isSuccess()) { return true; }else{ return false; ...
CWE-89
0
$db->insertObject($obj, 'expeAlerts_subscribers'); } $count = count($this->params['ealerts']); if ($count > 0) { flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.')); } 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 pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::ge...
CWE-89
0
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getA...
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 update() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $values = $this->request->getValues(); list($valid, $errors) = $this->tagValidator->validateModification($values); ...
CWE-639
9
public function manage_versions() { expHistory::set('manageable', $this->params); $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); $sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h '; $sql .= 'RIGHT JOIN '.DB_TABLE_PREF...
CWE-89
0
}elseif($p->group == 4){ $grp = GENERAL_MEMBER; }
CWE-89
0
public static function canImportData() { return true; }
CWE-89
0
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
CWE-89
0
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_notes WHERE website = '.protect($website->id), 'object' ); $out = $DB->result(); if($typ...
CWE-89
0
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
CWE-89
0
function updateCommandCategorieInDB(){ global $pearDB; $DBRESULT = $pearDB->query("UPDATE `command_categories` SET `category_name` = '".$_POST["category_name"]."' , `category_alias` = '".$_POST["category_alias"]."' , `category_order` = '".$_POST["category_order"]."' WHERE `cmd_category_id` = '".$_POST["cmd_cate...
CWE-89
0
function send_feedback() { $success = false; if (isset($this->params['id'])) { $ed = new eventdate($this->params['id']); // $email_addrs = array(); if ($ed->event->feedback_email != '') { $msgtemplate = expTemplate::get_template_for_action($th...
CWE-89
0
function core_load_function($fid) { global $DB; global $menu_layout; // check if fid is an internal function // or we need to retrieve its information from the database switch($fid) { case 'utils': $func = new stdClass(); $func->id = 'utils'; ...
CWE-89
0
function edit_optiongroup_master() { expHistory::set('editable', $this->params); $id = isset($this->params['id']) ? $this->params['id'] : null; $record = new optiongroup_master($id); assign_to_template(array( 'record'=>$record )); }
CWE-89
0
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0
public function approve() { expHistory::set('editable', $this->params); /* 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['r...
CWE-89
0
public function load_from_post() { if(intval($_REQUEST['parent'])!=$this->id) // protection against selecting this same category as parent of itself { $this->parent = intval($_REQUEST['parent']); } $this->template = $_REQUEST['template']; $this->access = intval($_REQU...
CWE-79
1
public function execute(&$params){ $model = new Actions; $model->type = 'note'; $model->complete = 'Yes'; $model->associationId = $params['model']->id; $model->associationType = $params['model']->module; $model->actionDescription = $this->parseOption('comment', $param...
CWE-79
1
$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 function download($name){ $attachFile = storage_path('app/'.str_replace("-","/",$name)); if(!is_file($attachFile)){ abort(404); } return response()->download($attachFile); }
CWE-494
22
$body = str_replace(array("\n"), "<br />", $body); } else { // It's going elsewhere (doesn't like quoted-printable) $body = str_replace(array("\n"), " -- ", $body); } $title = $items[...
CWE-89
0
private function _csv_text($text) { $text = stripslashes(htmlspecialchars($text)); return $text; }
CWE-79
1
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-918
16
public function IsHTML($ishtml = true) { if ($ishtml) { $this->ContentType = 'text/html'; } else { $this->ContentType = 'text/plain'; } }
CWE-79
1
function delete() { global $db; if (empty($this->params['id'])) return false; $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']); $product = new $product_type($this->params['id'], true, false); //eDebug($product_type); //eDebug...
CWE-89
0
public static function extract ($var, $m) { foreach ($var as $k2 => $v2) { if ($k2 != '0') { $va[] = [$k2 => $m[$v2]]; }elseif($k2 == ''){ $va = ['default']; }else{ $va = array($k2) ; } ...
CWE-89
0
public static function delete($id){ $vars = array( 'table' => 'user', 'where' => array( 'id' => $id ) ); Db::delete($vars); $vars = array( 'table' => 'user_detail', ...
CWE-89
0
protected function registerBackendPermissions() { BackendAuth::registerCallback(function ($manager) { $manager->registerPermissions('October.Backend', [ 'backend.access_dashboard' => [ 'label' => 'system::lang.permissions.view_the_dashboard', ...
CWE-79
1
public function create_media_dir($params) { must_have_access(); $resp = array(); // $target_path = media_base_path() . 'uploaded' . DS; $target_path = media_uploads_path(); $fn_path = media_base_path(); if (isset($_REQUEST['path']) and trim($_REQUEST['path']) != '...
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
public function testAddsDefaultReason() { $r = new Response('200'); $this->assertSame(200, $r->getStatusCode()); $this->assertEquals('OK', $r->getReasonPhrase()); }
CWE-89
0
public static function editParam($param, $value, $post_id) { $sql = "UPDATE `posts_param` SET `value` = '{$value}' WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' "; $q = Db::query($sql); if ($q) { return true; }else{ return false; } ...
CWE-89
0
: htmlspecialchars($host['User'])) . '</label></td>' . "\n" . '<td>' . htmlspecialchars($host['Host']) . '</td>' . "\n"; $html_output .= '<td>'; $password_column = 'Password'; $check_plugin_query = "SELECT * FROM `mysql`.`user` WHERE " ...
CWE-79
1
protected function _archive($dir, $files, $name, $arc) { die('Not yet implemented. (_archive)'); return false; }
CWE-89
0
function db_case($array) { global $DatabaseType; $counter = 0; if ($DatabaseType == 'mysqli') { $array_count = count($array); $string = " CASE WHEN $array[0] ="; $counter++; $arr_count = count($array); for ($i = 1; $i < $arr_count; $i++) { $value = $array[$i]; if ($value == "''" && substr($string, -...
CWE-22
2
public static function BBCode2Html($text) { $text = trim($text); $text = self::parseEmoji($text); // Smileys to find... $in = array( ); // And replace them by... $out = array( ); $in[] = '[/*]'; $in[] = '[*]'; $out[] = '</li>'; $out[]...
CWE-79
1
public function logout() { // Initialize the current auth session before trying to remove it if (is_null($this->user) && !$this->check()) { return; } if ($this->isImpersonator()) { $this->user = $this->getImpersonator(); $this->stopImpersonate...
CWE-613
7
public static function update_object_votes($webuser, $object, $object_id, $value, $replace=false) { global $DB; global $website; global $events; $status = false; $voted = false; $webuser_vote_id = null; // user has voted in the past? if($DB->query(' SELECT * FROM nv_webuser_...
CWE-89
0
function show_vendor () { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); $vendor_title = $vendor->title; $state = new geoRegion($vendor->state); $vendor->state = $state->name; //Removed unnecessary fields unset( ...
CWE-89
0
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); if ($this->customFilterModel->remove($filter['id']))...
CWE-639
9
function URLEscape( $string ) { $string = preg_replace_callback( // Match both decimal & hex code (although hex codes can contain a-f letters). // Should be enough as the alphabet hex codes only have numbers. "/(&#x?[0-9]+;?)/i", function( $match ) { if ( mb_substr( $match[1], -1 ) !== ';' ) { // Fix...
CWE-79
1
foreach ($fields as $field => $title) { if($i==0 && $j==0){ echo '<div class="row">'; }elseif($i==0 && $j>0){ echo '</div><div class="row">'; } echo '<div class="col-md-6"><label class="checkbox-inline"><...
CWE-22
2
protected function _fclose($fp, $path='') { @fclose($fp); if ($path) { @unlink($this->getTempFile($path)); } }
CWE-89
0
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
$value = (int)$_POST[$key]; } else { $value = strtotime($_POST[$key]); } $icmsObj->setVar($key, $value); break; case XOBJ_DTYPE_URL: if (isset($_POST[$key])) { $icmsObj->setVar($key, filter_var($_POST[$key], FILTER_SANITIZE_URL)); } break; case...
CWE-22
2
function logging($module,$command,$user=false){ global $database_eonweb; global $dateformat; if($user) sqlrequest($database_eonweb,"insert into logs values ('','".time()."','$user','$module','$command','".$_SERVER["REMOTE_ADDR"]."');"); elseif(isset($_COOKIE['user_name'])) sqlrequest($database_eonweb,"insert in...
CWE-79
1
public function rules() { return [ 'sku' => ['required'], 'name' => ['required', Rule::unique('products')->ignore($this->segment(3))], 'quantity' => ['required', 'integer', 'min:0'], 'price' => ['required', 'numeric', 'min:0'], 'sale_price' => ...
CWE-434
5
public function theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('D...
CWE-89
0
public function localFileSystemInotify($path, $standby, $compare) { if (isset($this->sessionCache['localFileSystemInotify_disable'])) { return false; } $path = realpath($path); $mtime = filemtime($path); if ($mtime != $compare) { return $mtime; } $inotifywait = defined('ELFINER_INOTIFYWAIT_PATH')? ...
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
public static function login() { user::login(expString::sanitize($_POST['username']),expString::sanitize($_POST['password'])); if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in flash('error', gt('Invalid Username / Password')); if (expSession::is_set('redirecturl_error')) { ...
CWE-89
0
public function setContainer($container, $type = 'ctText') { $this->container = $container; $container->setType($type); }
CWE-79
1
public function delete() { global $user; $count = $this->address->find('count', 'user_id=' . $user->id); if($count > 1) { $address = new address($this->params['id']); if ($user->isAdmin() || ($user->id == $address->user_id)) { if ($address->is_bill...
CWE-89
0
composerRequire57fe33d7077d32d85bc5d5df10c056df($file); } return $loader; }
CWE-89
0
public function testDoesNotTouchClosureListeners() { $this->getServer()->flush(); $this->getServer()->enqueue(array( "HTTP/1.1 200 OK\r\n" . "Date: Mon, 12 Nov 2012 03:06:37 GMT\r\n" . "Cache-Control: private, s-maxage=0, max-age=0, must-revalidate\r\n" . ...
CWE-89
0
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
$result[$index][1] = preg_replace( "/" . $find . "/", $replaceWith, $row[0] ); } } return $result; }
CWE-94
14
function searchName() { return gt('Webpage'); }
CWE-89
0
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
$this->paths[substr($key, strlen('path-'))] = $value; }
CWE-79
1
$section = new section($this->params); } else { notfoundController::handle_not_found(); exit; } if (!empty($section->id)) { $check_id = $section->id; } else { $check_id = $section->parent; } if (expPer...
CWE-89
0
$this->headerLines = ['Host' => [$host]] + $this->headerLines;
CWE-89
0