code
stringlengths
23
2.05k
label_name
stringlengths
6
7
label
int64
0
37
foreach ($day as $extevent) { $event_cache = new stdClass(); $event_cache->feed = $extgcalurl; $event_cache->event_id = $extevent->event_id; $event_cache->title = $extevent->title; ...
CWE-74
1
function fopen($filename, $mode) { if (\yiiunit\framework\base\SecurityTest::$fopen !== null) { return \yiiunit\framework\base\SecurityTest::$fopen; } return \fopen($filename, $mode); }
CWE-330
12
public function actionGetItems($modelType){ $sql = 'SELECT id, name as value FROM x2_campaigns WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = '%'.$_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO:...
CWE-20
0
public function __construct() { $this->setRichness( Config::getSetting( 'functionalRichness' ) ); if ( \DynamicPageListHooks::isLikeIntersection() ) { $this->data['ordermethod'] = [ 'default' => 'categoryadd', 'values' => [ 'categoryadd', 'lastedit', 'none' ] ]; $this->data['or...
CWE-400
2
private function _addauthor( $option ) { //Addauthor can not be used with addlasteditor. if ( !isset( $this->parametersProcessed['addlasteditor'] ) || !$this->parametersProcessed['addlasteditor'] ) { $this->addTable( 'revision_actor_temp', 'rev' ); $this->addWhere( [ $this->tableNames['page'] . '.pa...
CWE-400
2
public function Turn() { $this->error = array("error" => "This method, TURN, of the SMTP ". "is not implemented"); if($this->do_debug >= 1) { $this->edebug("SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />'); } return false; }
CWE-20
0
public function __construct( GlyphFinder $glyph_finder, ProjectXMLMerger $project_xml_merger, ConsistencyChecker $consistency_checker, TemplateDao $template_dao, ProjectManager $project_manager, EventDispatcherInterface $event_dispatcher, ) { $this->templa...
CWE-863
11
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-74
1
array_push($newgroupprivs, $type); } if(empty($newgroupprivs) || (count($newgroupprivs) == 1 && in_array("cascade", $newgroupprivs))) { return array('status' => 'error', 'errorcode' => 53, 'errormsg' => 'Invalid or missing permissions list supplied'); } up...
CWE-20
0
public function IsQmail() { if (stristr(ini_get('sendmail_path'), 'qmail')) { $this->Sendmail = '/var/qmail/bin/sendmail'; } $this->Mailer = 'sendmail'; }
CWE-20
0
public function Reset() { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Reset() without being connected"); return false; } fputs($this->smtp_conn,"RSET" . $this->CRLF); $rply = $this->get_lines(); ...
CWE-20
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-74
1
public function testXForwarderForHeaderForForwardedRequests($xForwardedFor, $expected) { $this->setNextResponse(); $server = array('REMOTE_ADDR' => '10.0.0.1'); if (false !== $xForwardedFor) { $server['HTTP_X_FORWARDED_FOR'] = $xForwardedFor; } $this->request(...
CWE-20
0
public function merge($branch, $options = NULL) { $this->run('merge', $options, $branch); return $this; }
CWE-77
14
public function __get($var) { switch ($var) { case 'configuration_array': $this->configuration_array = array(); if ($this->configuration != ''){ $jsonData = json_decode($this->configuration,true); if ($jsonData !==...
CWE-116
15
function edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['o...
CWE-74
1
public function getTrustedProxyData() { return array( array(array(), array('127.0.0.1')), array(array('10.0.0.2'), array('10.0.0.2', '127.0.0.1')), array(array('10.0.0.2', '127.0.0.1'), array('10.0.0.2', '127.0.0.1')), ); }
CWE-20
0
array_push($stack, $node); } } return array( 'status' => 'success', 'nodes' => $nodes); } else { return array( 'status' => 'error', 'errorcode' => 56, 'errormsg' => 'User cannot access node content'); ...
CWE-20
0
public function beforeAction($action) { // Bypass when not installed for installer if (empty(Yii::$app->params['installed']) && Yii::$app->controller->module != null && Yii::$app->controller->module->id == 'installer') { return true; } ...
CWE-863
11
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-74
1
function configure() { expHistory::set('editable', $this->params); // little bit of trickery so that that categories can have their own configs $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $pu...
CWE-74
1
public function testCookiePathWithEmptySetCookiePath($uriPath, $cookiePath) { $response = (new Response(200)) ->withAddedHeader( 'Set-Cookie', "foo=bar; expires={$this->futureExpirationDate()}; domain=www.example.com; path=;" ) ->withAd...
CWE-200
10
public function crossOriginRedirectProvider() { return [ ['http://example.com?a=b', 'http://test.com/', false], ['https://example.com?a=b', 'https://test.com/', false], ['http://example.com?a=b', 'https://test.com/', false], ['https://example.com?a=b', 'ht...
CWE-200
10
public function __construct( CartService $cartService, int $defaultTtl, bool $httpCacheEnabled, MaintenanceModeResolver $maintenanceModeResolver ) { $this->cartService = $cartService; $this->defaultTtl = $defaultTtl; $this->httpCacheEnabled = $httpCacheEna...
CWE-200
10
public function safePath($filename = 'data.csv'){ return implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'data', $filename )); }
CWE-20
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-200
10
public function paramRules() { return array( 'title' => Yii::t('studio',$this->title), 'info' => Yii::t('studio',$this->info), 'modelRequired' => 'Contacts', 'options' => array( array( 'name'=>'listId', 'label'=>Yii::t('studio','List'), 'typ...
CWE-20
0
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-200
10
function showByModel() { global $order, $template, $db; expHistory::set('viewable', $this->params); $product = new product(); $model = $product->find("first", 'model="' . $this->params['model'] . '"'); //eDebug($model); $product_type = new $model->product_type($model...
CWE-20
0
public function getBranches() { if (null === $this->branches) { $branches = array(); $bookmarks = array(); $this->process->execute('hg branches', $output, $this->repoDir); foreach ($this->process->splitLines($output) as $branch) { if ($bra...
CWE-20
0
public function saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->...
CWE-74
1
function twig_array_reduce(Environment $env, $array, $arrow, $initial = null) { if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { throw new RuntimeError('The callable passed to the "reduce" fil...
CWE-74
1
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-74
1
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-74
1
public function getError() { return $this->error; }
CWE-20
0
public function configure() { $this->config['defaultbanner'] = array(); if (!empty($this->config['defaultbanner_id'])) { $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']); } parent::configure(); $banners = $this->banner->find('all', nul...
CWE-74
1
public function testFirstTrustedProxyIsSetAsRemote() { $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $expectedSubRequest->server->set('REMOTE_ADDR', '1.1.1.1'); if (Request::getTrustedHeaderName(Request::H...
CWE-20
0
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
CWE-74
1
private function edebug($str) { if ($this->Debugoutput == "error_log") { error_log($str); } else { echo $str; } }
CWE-20
0
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-74
1
$description = "User (" . $this->User->id . "): " . $this->Auth->user('email'); $fieldsResult = "Password changed."; } // query $this->Log = ClassRegistry::init('Log'); $this->Log->create(); $this->Log->save(array( 'org' => $this->Auth->user('...
CWE-269
6
$criteria->addCondition ( 'user IN (' . 'SELECT DISTINCT b.username ' . 'FROM x2_group_to_user a JOIN x2_group_to_user b ' . 'ON a.groupId=b.groupId ' . 'WHERE a.username=:getAccessCriteri...
CWE-20
0
function searchCategory() { return gt('Event'); }
CWE-74
1
public function saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->...
CWE-74
1
function XMLRPCgetUserGroupPrivs($name, $affiliation, $nodeid){ require_once(".ht-inc/privileges.php"); global $user; if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)){ return array('status' => 'error', 'errorcode' => 53, 'errormsg' => 'Unable to ad...
CWE-20
0
foreach ($days as $event) { if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break; if (empty($event->eventstart)) $eve...
CWE-74
1
public function __construct( \DPL\Parameters $parameters, \Parser $parser ) { parent::__construct( $parameters, $parser ); $this->textSeparator = $parameters->getParameter( 'inlinetext' ); }
CWE-400
2
public function showUnpublished() { expHistory::set('viewable', $this->params); // setup the where clause for looking up records. $where = parent::aggregateWhereClause(); $where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where; ...
CWE-74
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-74
1
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
CWE-74
1
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-74
1
public function Archive() { // Update "main" ticket $upd_stmt = Database::prepare(' UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `id` = :tid' ); Database::pexecute($upd_stmt, array('tid' => $this->tid)); // Update "answers" to ticket $upd_stmt = Database::prepare(' UPDATE `' . TA...
CWE-732
13
return "__NOTOC____NOEDITSECTION__" . \CategoryViewer::shortList( $articleLinks, $articleStartChars ); } return ''; }
CWE-400
2
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
CWE-74
1
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
CWE-74
1
public function setPageTextMatchNotRegex( array $pageTextMatchNotRegex = [] ) { $this->pageTextMatchNotRegex = (array)$pageTextMatchNotRegex; }
CWE-400
2
function searchCategory() { return gt('Event'); }
CWE-74
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-200
10
public function testAuthCheckDecryptPassword() { $GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey'; $GLOBALS['server'] = 1; $_REQUEST['old_usr'] = ''; $_REQUEST['pma_username'] = ''; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = ...
CWE-200
10
public function testNotRemoveAuthorizationHeaderOnRedirect() { $mock = new MockHandler([ new Response(302, ['Location' => 'http://example.com/2']), static function (RequestInterface $request) { self::assertTrue($request->hasHeader('Authorization')); ...
CWE-200
10
public function wp_footer() { global $geo_mashup_options; if ( $this->add_form_script ) { GeoMashup::register_script( 'geo-mashup-comment-form', 'js/comment-form.js', array( 'jquery' ), GEO_MASHUP_VERSION, true ); wp_localize_script( 'geo-mashup-comment-form', 'g...
CWE-20
0
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
CWE-74
1
public static function dplParserFunction( &$parser ) { self::setLikeIntersection( false ); $parser->addTrackingCategory( 'dpl-parserfunc-tracking-category' ); // callback for the parser function {{#dpl: or {{DynamicPageList:: $input = ""; $numargs = func_num_args(); if ( $numargs < 2 ) { $input =...
CWE-400
2
foreach ($days as $value) { $regitem[] = $value; }
CWE-74
1
public function destroy(PaymentMethod $paymentMethod) { $this->authorize('delete', $paymentMethod); $payments = $paymentMethod->payments; if ($payments->count() > 0) { return respondJson('payments_attached', 'Payments Attached.'); } $paymentMethod->delete()...
CWE-862
8
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
CWE-74
1
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-74
1
public static function parseAndTrim($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 = str_re...
CWE-74
1
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,n...
CWE-74
1
function getResourceGroupID($groupdname) { list($type, $name) = explode('/', $groupdname); $query = "SELECT g.id " . "FROM resourcegroup g, " . "resourcetype t " . "WHERE g.name = '$name' AND " . "t.name = '$type' AND " . "g.resourcetypeid = t.id"; $qh = doQue...
CWE-20
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-74
1
function searchName() { return gt("Calendar Event"); }
CWE-74
1
$path = Helpers::isAbsolute($item) ? $item : ($this->getRepositoryPath() . DIRECTORY_SEPARATOR . $item); if (!file_exists($path)) { throw new GitException("The path at '$item' does not represent a valid file."); } $this->run('add', $item); }
CWE-77
14
$params = ['uitype' => 71, 'displaytype' => 1, 'typeofdata' => 'N~O', 'isEditableReadOnly' => false, 'maximumlength' => '99999999999999999'];
CWE-20
0
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-74
1
public static function wpSetUpBeforeClass( $factory ) { self::make_user_by_role( 'administrator' ); self::$post = $factory->post->create_and_get(); }
CWE-862
8
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-200
10
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-74
1
public static function getHelpVersionId($version) { global $db; return $db->selectValue('help_version', 'id', 'version="'.$version.'"'); }
CWE-74
1
function searchByModelForm() { // get the search terms $terms = $this->params['search_string']; $sql = "model like '%" . $terms . "%'"; $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10; $page = new expPaginator(array( 'model' => 'produc...
CWE-20
0
public function handle($stanza, $parent = false) { $message = $stanza->forwarded->message; $jid = explode('/',(string)$message->attributes()->from); $to = current(explode('/',(string)$message->attributes()->to)); if($message->composing) $this->event('composing', arr...
CWE-20
0
function prepareInputForAdd($input) { //If it's the first ldap directory then set it as the default directory if (!self::getNumberOfServers()) { $input['is_default'] = 1; } if (isset($input["rootdn_passwd"]) && !empty($input["rootdn_passwd"])) { $input["rootdn_passwd"] = T...
CWE-327
3
public function addJoin( $tableAlias, $joinConditions ) { if ( empty( $tableAlias ) || empty( $joinConditions ) ) { throw new \MWException( __METHOD__ . ': An empty join clause was passed.' ); } if ( isset( $this->join[$tableAlias] ) ) { throw new \MWException( __METHOD__ . ': Attempted to overwrite existi...
CWE-400
2
static function isSearchable() { return true; }
CWE-74
1
function wp_validate_redirect($location, $default = '') { $location = trim( $location ); // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//' if ( substr($location, 0, 2) == '//' ) $location = 'http:' . $location; // In php 5 parse_url may fail if the URL query pa...
CWE-20
0
static function displayname() { return gt("e-Commerce Category Manager"); }
CWE-74
1
public function crossOriginRedirectProvider() { return [ ['http://example.com?a=b', 'http://test.com/', false], ['https://example.com?a=b', 'https://test.com/', false], ['http://example.com?a=b', 'https://test.com/', false], ['https://example.com?a=b', 'ht...
CWE-200
10
function XMLRPCaddImageToGroup($name, $imageid){ $groups = getUserResources(array("imageAdmin"), array("manageGroup"), 1); if($groupid = getResourceGroupID("image/$name")){ if(!array_key_exists($groupid, $groups['image'])){ return array('status' => 'error', 'err...
CWE-20
0
function addDiscountToCart() { // global $user, $order; global $order; //lookup discount to see if it's real and valid, and not already in our cart //this will change once we allow more than one coupon code $discount = new discounts(); $discount = $discount->getCoupon...
CWE-20
0
private function generateTempFileData() { return [ 'name' => md5(mt_rand()), 'tmp_name' => tempnam(sys_get_temp_dir(), ''), 'type' => 'image/jpeg', 'size' => mt_rand(1000, 10000), 'error' => '0', ]; }
CWE-330
12
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-200
10
public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) { $this->host = $host; // If no port value is passed, retrieve it if ($port == false) { $this->port = $this->POP3_PORT; } else { $this->port = $port; } // If no port value is...
CWE-20
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-327
3
private function __construct($userinfo, $tid = - 1) { $this->userinfo = $userinfo; $this->tid = $tid; // initialize data array $this->initData(); // read data from database $this->readData(); }
CWE-732
13
public function testIpAddressOfRangedTrustedProxyIsSetAsRemote() { $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $expectedSubRequest->server->set('REMOTE_ADDR', '1.1.1.1'); $expectedSubRequest->headers->set...
CWE-20
0
$modelNames[ucfirst($module->name)] = self::getModelTitle($modelName); } asort ($modelNames); if ($criteria !== null) { return $modelNames; } else { self::$_modelNames = $modelNames; } } retur...
CWE-20
0
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "addresses as a "; //R J...
CWE-74
1
public static function getSubcategories( $categoryName, $depth = 1 ) { $DB = wfGetDB( DB_REPLICA, 'dpl' ); if ( $depth > 2 ) { //Hard constrain depth because lots of recursion is bad. $depth = 2; } $categories = []; $result = $DB->select( [ 'page', 'categorylinks' ], [ 'page_title' ], [ '...
CWE-400
2
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
CWE-74
1
$layout[$loc] = array_merge($layout[$loc],$data); } } } return $layout; }
CWE-20
0