code
stringlengths
23
2.05k
label_name
stringlengths
6
7
label
int64
0
37
public function Recipient($to) { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Recipient() without being connected"); return false; } fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); $...
CWE-20
0
public function testClientIpIsAlwaysLocalhostForForwardedRequests() { $this->setNextResponse(); $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); $this->assertEquals('127.0.0.1', $this->kernel->getBackendRequest()->server->get('REMOTE_ADDR')); }
CWE-20
0
private function convertTimestamp( $inputDate ) { $timestamp = $inputDate; switch ( $inputDate ) { case 'today': $timestamp = date( 'YmdHis' ); break; case 'last hour': $date = new \DateTime(); $date->sub( new \DateInterval( 'P1H' ) ); $timestamp = $date->format( 'YmdHis' ); break; ...
CWE-400
2
static function description() { return gt("This module is for managing categories in your store."); }
CWE-74
1
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-20
0
public static function dumpArray( $arg ) { $numargs = count( $arg ); if ( $numargs < 3 ) { return ''; } $var = trim( $arg[2] ); $text = " array {$var} = {"; $n = 0; if ( array_key_exists( $var, self::$memoryArray ) ) { foreach ( self::$memoryArray[$var] as $value ) { if ( $n++ > 0 ) { ...
CWE-400
2
} elseif ( $sSecLabel[0] != '{' ) { $limpos = strpos( $sSecLabel, '[' ); $cutLink = 'default'; $skipPattern = []; if ( $limpos > 0 && $sSecLabel[strlen( $sSecLabel ) - 1] == ']' ) { // regular expressions which define a skip pattern may precede the text $fmtSec = explode( '~...
CWE-400
2
public function __construct(OrderService $orderService) { $this->orderService = $orderService; }
CWE-200
10
public function IsSendmail() { if (!stristr(ini_get('sendmail_path'), 'sendmail')) { $this->Sendmail = '/var/qmail/bin/sendmail'; } $this->Mailer = 'sendmail'; }
CWE-20
0
$section = new section(intval($page)); if ($section) { // self::deleteLevel($section->id); $section->delete(); } } }
CWE-74
1
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-74
1
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-74
1
public function resetauthkey($id = null) { if (!$this->_isAdmin() && Configure::read('MISP.disableUserSelfManagement')) { throw new MethodNotAllowedException('User self-management has been disabled on this instance.'); } if ($id == 'me') { $id = $this->Auth->user(...
CWE-269
6
public function delete(DeleteInvoiceRequest $request) { $this->authorize('delete multiple invoices'); Invoice::destroy($request->ids); return response()->json([ 'success' => true, ]); }
CWE-862
8
static public function getPriorityText($_lng, $_priority = 0) { switch($_priority) { case 1: return $_lng['ticket']['high']; break; case 2: return $_lng['ticket']['normal']; break; default: return $_lng['ticket']['low']; break; } }
CWE-732
13
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
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
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-74
1
public function setItemAttributes( $attributes ) { $this->itemAttributes = \Sanitizer::fixTagAttributes( $attributes, 'li' ); }
CWE-400
2
private function initData() { $this->Set('customer', 0, true, true); $this->Set('admin', 1, true, true); $this->Set('subject', '', true, true); $this->Set('category', '0', true, true); $this->Set('priority', '2', true, true); $this->Set('message', '', true, true); $this->Set('dt', 0, true, true); $thi...
CWE-732
13
foreach ($days as $value) { $regitem[] = $value; }
CWE-74
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-200
10
$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-74
1
function edit() { global $template; parent::edit(); $allforms = array(); $allforms[""] = gt('Disallow Feedback'); // calculate which event date is the one being edited $event_key = 0; foreach ($template->tpl->tpl_vars['record']->value->eventdate as $k...
CWE-74
1
public function SetFrom($address, $name = '', $auto = 1) { $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim if (!$this->ValidateAddress($address)) { $this->SetError($this->Lang('invalid_address').': '. $address); if ($this->exceptions) { ...
CWE-20
0
$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-74
1
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-74
1
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-200
10
public function recipient($toaddr) { return $this->sendCommand( 'RCPT TO', 'RCPT TO:<' . $toaddr . '>', array(250, 251) ); }
CWE-20
0
public function save() { $data = $_POST['file']; // security (remove all ..) $data['name'] = str_replace('..', '', $data['name']); $file = FILES_DIR . DS . $data['name']; // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csr...
CWE-20
0
function getTextColumns($table) { $sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'"; $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $records = array(); while($row = mysqli_fetch_object($res)) { $records[] = $ro...
CWE-74
1
public static function dplReplaceParserFunction( &$parser, $text, $pat = '', $repl = '' ) { $parser->addTrackingCategory( 'dplreplace-parserfunc-tracking-category' ); if ( $text == '' || $pat == '' ) { return ''; } # convert \n to a real newline character $repl = str_replace( '\n', "\n", $repl ); # rep...
CWE-400
2
public function approve_submit() { if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); expHistory::back(); } /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the...
CWE-74
1
public function actionGetItems(){ $model = X2Model::model ($this->modelClass); if (isset ($model)) { $tableName = $model->tableName (); $sql = 'SELECT id, fileName as value FROM '.$tableName.' WHERE associationType!="theme" ...
CWE-20
0
private function _minoredits( $option ) { if ( isset( $option ) && $option == 'exclude' ) { $this->addTable( 'revision', 'revision' ); $this->addWhere( 'revision.rev_minor_edit = 0' ); } }
CWE-400
2
$object->size = convert_size($cur->getSize()); $object->mtime = date('D, j M, Y', $cur->getMTime()); list($object->perms, $object->chmod) = $this->_getPermissions($cur->getPerms()); // Find the file type $object->type = $th...
CWE-20
0
public function actionGetLists() { if (!Yii::app()->user->checkAccess('ContactsAdminAccess')) { $condition = ' AND (visibility="1" OR assignedTo="Anyone" OR assignedTo="' . Yii::app()->user->getName() . '"'; /* x2temp */ $groupLinks = Yii::app()->db->createCommand()->sel...
CWE-20
0
private function setHeader( $header ) { if ( \DynamicPageListHooks::getDebugLevel() == 5 ) { $header = '<pre><nowiki>' . $header; } $this->header = $this->replaceVariables( $header ); }
CWE-400
2
public function admin_print_scripts( $not_used ) { // Load any uploaded KML into the search map - only works with browser uploader // See if wp_upload_handler found uploaded KML $kml_url = get_transient( 'gm_uploaded_kml_url' ); if (strlen($kml_url) > 0) { // Load the KML in the location editor ...
CWE-20
0
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
CWE-74
1
public function upload() { if (!AuthUser::hasPermission('file_manager_upload')) { Flash::set('error', __('You do not have sufficient permissions to upload a file.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_POST[...
CWE-20
0
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank")...
CWE-74
1
protected function generateVerifyCode() { if ($this->minLength > $this->maxLength) { $this->maxLength = $this->minLength; } if ($this->minLength < 3) { $this->minLength = 3; } if ($this->maxLength > 20) { $this->maxLength = 20; ...
CWE-330
12
static function description() { return "Manage events and schedules, and optionally publish them."; }
CWE-74
1
foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;')); if (!empty($multiday_event)) { ...
CWE-74
1
public function init() { global $geo_mashup_options, $pagenow; // Enable this interface when the option is set and we're on a destination page $enabled = is_admin() && $geo_mashup_options->get( 'overall', 'located_object_name', 'user' ) == 'true' && preg_match( '/(user-edit|profile).php/', $pagenow ...
CWE-20
0
function manage () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchas...
CWE-74
1
public function manage_sitemap() { global $db, $user, $sectionObj, $sections; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // all we need to do is determine the current section $navsections = $sections; if (...
CWE-74
1
public function IsMail() { $this->Mailer = 'mail'; }
CWE-20
0
public function getViewFileParams () { if (!isset ($this->_viewFileParams)) { $this->_viewFileParams = array_merge ( parent::getViewFileParams (), array ( 'chartType' => $this->chartType, 'chartSettingsDataProvider' => self::getChart...
CWE-20
0
foreach($return as $index => $value) { if(! is_string($value)) $return[$index] = $defaultvalue; elseif($addslashes) $return[$index] = addslashes($value); }
CWE-20
0
static::$functions = ['random_bytes' => false, 'openssl_random_pseudo_bytes' => false, 'mcrypt_create_iv' => false];
CWE-330
12
$v = trim($v); if ($v !== '') { $_POST[$key][] = $v; } } }
CWE-200
10
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-74
1
public function getPurchaseOrderByJSON() { if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchase_order->find('all'); } echo json_encode($purchase_orders); }
CWE-20
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-74
1
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-200
10
public function approve_submit() { global $history; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); $lastUrl = expHistory::getLast('editable'); } /* The global constants can be overriden by passi...
CWE-74
1
function scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); ...
CWE-74
1
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-74
1
function barcode_encode_genbarcode($code,$encoding) { global $genbarcode_loc; // Clean parameters if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) $code=substr($code,0,12); if (!$encoding) $encoding="ANY"; $encoding=preg_replace("/[\\\|]/", "_", $encoding); $code=preg_replace("/[\\\|...
CWE-20
0
function test_valid_comment() { $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => rand_str( 100 ), ), ) ); $this->assertNotIXRError( $result ); }
CWE-862
8
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-74
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-200
10
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-200
10
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-200
10
private function getResponse ($size = 128) { $pop3_response = fgets($this->pop_conn, $size); return $pop3_response; }
CWE-20
0
function process_subsections($parent_section, $subtpl) { global $db, $router; $section = new stdClass(); $section->parent = $parent_section->id; $section->name = $subtpl->name; $section->sef_name = $router->encode($section->name); $...
CWE-74
1
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-74
1
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $m...
CWE-74
1
static function displayname() { return gt("Navigation"); }
CWE-74
1
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-74
1
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_re...
CWE-74
1
protected function renderText ($field, $makeLinks, $textOnly, $encode) { $fieldName = $field->fieldName; $value = preg_replace("/(\<br ?\/?\>)|\n/"," ",$this->owner->$fieldName); return Yii::app()->controller->convertUrls($this->render ($value, $encode)); }
CWE-20
0
private function _addfirstcategorydate( $option ) { //@TODO: This should be programmatically determining which categorylink table to use instead of assuming the first one. $this->addSelect( [ 'cl_timestamp' => "DATE_FORMAT(cl1.cl_timestamp, '%Y%m%d%H%i%s')" ] ); }
CWE-400
2
public function initializeObject() { $this->initializeFormStateFromRequest(); $this->initializeCurrentPageFromRequest(); if (!$this->isFirstRequest()) { $this->processSubmittedFormValues(); } }
CWE-20
0
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
CWE-74
1
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-200
10
function delete_option_master() { global $db; $masteroption = new option_master($this->params['id']); // delete any implementations of this option master $db->delete('option', 'option_master_id='.$masteroption->id); $masteroption->delete('optiongroup_master_id=' . $...
CWE-74
1
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->ge...
CWE-200
10
public static function showModal($params) { if (!isset($params['argument']) || empty($params['argument'])) { return array( 'processed' => true, 'process_status' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatcommand', 'Please provide ...
CWE-116
15
$text = preg_replace( $skipPat, '', $text ); } if ( self::open( $parser, $part1 ) ) { //Handle recursion here, so we can break cycles. if ( $recursionCheck == false ) { $text = $parser->preprocess( $text, $parser->mTitle, $parser->mOptions ); self::close( $parser, $part1 ); } if ( $maxLeng...
CWE-400
2
public function IsSMTP() { $this->Mailer = 'smtp'; }
CWE-20
0
function reset_stats() { // global $db; // reset the counters // $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1'); banner::resetImpressions(); // $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1'); banner::resetClicks(); /...
CWE-74
1
public function testPOSTForRestProjectManager() { $post_resource = json_encode([ 'label' => 'Test Request 9748', 'shortname' => 'test9748', 'description' => 'Test of Request 9748 for REST API Project Creation', 'is_public' => true, 'template_i...
CWE-863
11
public static function validateByRegex($path, $values, $regex) { $result = preg_match($regex, $values[$path]); return array($path => ($result ? '' : __('Incorrect value!'))); }
CWE-200
10
recyclebin::sendToRecycleBin($loc, $parent); //FIXME if we delete the module & sectionref the module completely disappears // if (class_exists($secref->module)) { // $modclass = $secref->module; // //FIXME: more module/controller glue code // ...
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
function delete_vendor() { global $db; if (!empty($this->params['id'])){ $db->delete('vendor', 'id =' .$this->params['id']); } expHistory::back(); }
CWE-74
1
public static function getHost() { if (isset($_SERVER['HTTP_HOST'])) { $site_address = (erLhcoreClassSystem::$httpsMode == true ? 'https:' : 'http:') . '//' . $_SERVER['HTTP_HOST'] ; } else if (class_exists('erLhcoreClassInstance')) { $site_address = 'https://' . erLhcoreClassIns...
CWE-116
15
private function isWindows() { return DIRECTORY_SEPARATOR !== '/'; }
CWE-330
12
public static function onParserFirstCallInit( Parser &$parser ) { self::init(); //DPL offers the same functionality as Intersection. So we register the <DynamicPageList> tag in case LabeledSection Extension is not installed so that the section markers are removed. if ( \DPL\Config::getSetting( 'handleSectionTa...
CWE-400
2
function __construct(bool $connect = false) { global $CFG_GLPI; $options = [ 'base_uri' => GLPI_MARKETPLACE_PLUGINS_API_URI, 'connect_timeout' => self::TIMEOUT, ]; // add proxy string if configured in glpi if (!empty($CFG_GLPI["proxy_name"])) { $proxy...
CWE-327
3
private function _stablepages( $option ) { if ( function_exists( 'efLoadFlaggedRevs' ) ) { //Do not add this again if 'qualitypages' has already added it. if ( !$this->parametersProcessed['qualitypages'] ) { $this->addJoin( 'flaggedpages', [ "LEFT JOIN", "page_id = fp_page_id" ] ...
CWE-400
2
public function update($user, $notrigger = 0) { global $langs, $conf; $error = 0; // Clean parameters $this->address = ($this->address > 0 ? $this->address : $this->address); $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); $this->town = ($this->town > 0 ? $this->town : $this->town); $this->co...
CWE-20
0
function XMLRPCremoveImageFromGroup($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', ...
CWE-20
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-74
1
protected function registerBackendPermissions() { BackendAuth::registerCallback(function ($manager) { $manager->registerPermissions('October.System', [ 'system.manage_updates' => [ 'label' => 'system::lang.permissions.manage_software_updates', ...
CWE-269
6
public static function newFromRow( $row, Parameters $parameters, \Title $title, $pageNamespace, $pageTitle ) { global $wgLang; $article = new Article( $title, $pageNamespace ); $revActorName = null; if ( isset( $row['revactor_actor'] ) ) { $revActorName = User::newFromActorId( $row['revactor_actor'] )->ge...
CWE-400
2
$date->delete(); // event automatically deleted if all assoc eventdates are deleted } expHistory::back(); }
CWE-74
1