code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
private function _new_password($user_id = 0, $password, $token) { $auth = Auth::instance(); $user = ORM::factory('user',$user_id); if ($user->loaded == true) { // Determine Method (RiverID or standard) if (kohana::config('riverid.enable') == TRUE AND ! empty($user->riverid)) { // Use Ri...
CWE-640
20
public function actionDeleteDropdown() { $dropdowns = Dropdowns::model()->findAll(); if (isset($_POST['dropdown'])) { if ($_POST['dropdown'] != Actions::COLORS_DROPDOWN_ID) { $model = Dropdowns::model()->findByPk($_POST['dropdown']); $model->delete(); ...
CWE-79
1
public static function getTemplateHierarchyFlat($parent, $depth = 1) { global $db; $arr = array(); $kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank'); // $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC')); for ($i = 0, $i...
CWE-89
0
$section = new section(intval($page)); if ($section) { // self::deleteLevel($section->id); $section->delete(); } } }
CWE-89
0
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
CWE-22
2
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 remove() { $id = (int)$this->id; try { $delete = $this->zdb->delete(self::TABLE); $delete->where( self::PK . ' = ' . $id ); $this->zdb->execute($delete); Analog::log( 'Saved search #' . $i...
CWE-89
0
private function flatten(iterable $array, array &$result, string $keySeparator, string $parentKey = '', bool $escapeFormulas = false) { foreach ($array as $key => $value) { if (is_iterable($value)) { $this->flatten($value, $result, $keySeparator, $parentKey.$key.$keySeparator...
CWE-1236
12
public function testPathMustBeValid() { (new Uri(''))->withPath([]); }
CWE-89
0
public static function canView($section) { global $db; if ($section == null) { return false; } if ($section->public == 0) { // Not a public section. Check permissions. return expPermissions::check('view', expCore::makeLocation('navigation...
CWE-89
0
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
CWE-89
0
public function remove() { $id = (int)$this->id; if ($this->isSystemType()) { throw new \RuntimeException(_T("You cannot delete system payment types!")); } try { $delete = $this->zdb->delete(self::TABLE); $delete->where( self::...
CWE-89
0
static function displayname() { return gt("e-Commerce Category Manager"); }
CWE-89
0
private function edebug($str) { if ($this->Debugoutput == "error_log") { error_log($str); } else { echo $str; } }
CWE-79
1
public function __construct() { }
CWE-89
0
$iloc = expUnserialize($container->internal); if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) { // There is no sectionref for this container. Populate sectionref if ($container->external != "N;") { $newSecRef = new stdClass...
CWE-89
0
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-639
9
private function resize_gd($src, $width, $height, $quality, $srcImgInfo) { switch ($srcImgInfo['mime']) { case 'image/gif': if (@imagetypes() & IMG_GIF) { $oSrcImg = @imagecreatefromgif($src); } else { $ermsg = 'GIF images are not supported'; } break; case 'image/jpeg': if (@image...
CWE-89
0
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); ...
CWE-79
1
public function Login ($username = '', $password = '') { if ($this->connected == false) { $this->error = 'Not connected to POP3 server'; if ($this->do_debug >= 1) { $this->displayErrors(); } } if (empty($username)) { $username = $this->username; } if (empty($pass...
CWE-79
1
public function __construct() { self::map(); }
CWE-89
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-89
0
function draw_cdef_preview($cdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>cdef=<?php print get_cdef($cdef_id, true);?></pre> </td> </tr> <?php }
CWE-79
1
function remove() { global $db; $section = $db->selectObject('section', 'id=' . $this->params['id']); if ($section) { section::removeLevel($section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); ...
CWE-89
0
function edit_option_master() { expHistory::set('editable', $this->params); $params = isset($this->params['id']) ? $this->params['id'] : $this->params; $record = new option_master($params); assign_to_template(array( 'record'=>$record )); }
CWE-89
0
public static function navtojson() { return json_encode(self::navhierarchy()); }
CWE-89
0
public static function addViews($id) { $botlist = self::botlist(); $nom = 0; foreach($botlist as $bot) { if(preg_match("/{$bot}/", $_SERVER['HTTP_USER_AGENT'])) { $nom = 1+$nom; }else{ $nom = 0; } } ...
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 start() { @session_start(); $this->started = session_id()? true : false; return $this; }
CWE-89
0
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-89
0
public function getSection() { global $db; if (expTheme::inAction()) { if (isset($_REQUEST['section'])) { $section = $this->url_style=="sef" ? $this->getPageByName($_REQUEST['section'])->id : intval($_REQUEST['section']) ; } else { $section = ...
CWE-89
0
public function onRouteStartup(Enlight_Controller_EventArgs $args) { $request = $args->getRequest(); if (strpos($request->getPathInfo(), '/backend') === 0 || strpos($request->getPathInfo(), '/api/') === 0 ) { return; } $shop = $this->getShopByReq...
CWE-601
11
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
CWE-79
1
public static function getModelTypes($assoc = false) { $modelTypes = Yii::app()->db->createCommand() ->selectDistinct('modelName') ->from('x2_fields') ->where('modelName!="Calendar"') ->order('modelName ASC') ->queryColumn(); ...
CWE-79
1
public static function isExist($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 = sprin...
CWE-89
0
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 static function dropdown($vars) { if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE "; if(isset($vars['parent'])) { $where .= " `parent` = '{$vars['parent']}' "; }else{ $where .= "1...
CWE-79
1
public static function navtojson() { return json_encode(self::navhierarchy()); }
CWE-89
0
$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
public static function find($code) { global $DB; global $website; $DB->query(' SELECT * FROM nv_coupons WHERE website = '.protect($website->id).' AND code = '.protect($code), 'object' ); $r...
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-22
2
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
CWE-89
0
public function get($key, $default = null, $deep = false) { if ($deep) { @trigger_error('Using paths to find deeper items in '.__METHOD__.' is deprecated since version 2.8 and will be removed in 3.0. Filter the returned value in your own code instead.', E_USER_DEPRECATED); } ...
CWE-89
0
$files[$i] = '.' . DIRECTORY_SEPARATOR . basename($file); } $files = array_map('escapeshellarg', $files); $cmd = $arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . implode(' ', $files); $err_out = ''; ...
CWE-918
16
return $fa->nameGlyph($icons, 'icon-'); } } else { return array(); } }
CWE-89
0
function _real_escape( $string ) { if ( $this->dbh ) { if ( $this->use_mysqli ) { return mysqli_real_escape_string( $this->dbh, $string ); } else { return mysql_real_escape_string( $string, $this->dbh ); } } $class = get_class( $this ); if ( function_exists( '__' ) ) { /* translators: %s: ...
CWE-89
0
form_end_row(); $i++; } html_end_box(false); /* print "<pre>"; if (isset($check) && is_array($check)) { print_r($check); } print "</pre>"; */ }
CWE-79
1
form_selectable_cell('<a class="linkEditMain" href="' . html_escape('automation_networks.php?action=edit&id=' . $network['id']) . '">' . $network['name'] . '</a>', $network['id']); form_selectable_cell($network['data_collector'], $network['id']); form_selectable_cell($sched_types[$network['sched_type']], $netw...
CWE-79
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-89
0
function __construct($apikey){ $this->apikey = $apikey; $this->config = $this->getConfig($apikey); //echo $this->apikey; }
CWE-89
0
public function search_external() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->pref...
CWE-89
0
function _download_header($filename, $filesize = 0) { $browser=id_browser(); header('Content-Type: '.(($browser=='IE' || $browser=='OPERA')? 'application/octetstream':'application/octet-stream'));
CWE-22
2
public function getSupportedBrands() { return array( static::BRAND_VISA => '/^4\d{12}(\d{3})?$/', static::BRAND_MASTERCARD => '/^(5[1-5]\d{4}|677189)\d{10}$/', static::BRAND_DISCOVER => '/^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/', static::BRAND_AMEX =>...
CWE-89
0
public function subscriptions() { global $db; expHistory::set('manageable', $this->params); // make sure we have what we need. if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.')); if (empty($this->par...
CWE-89
0
public static function is_loggedin () { $username = Session::val('username'); if(isset($username)) { $v = true; }else{ $v = false; } return $v; }
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 static function add($var) { $route = self::$_route; self::$_route = array_merge($route, $var); return self::$_route; }
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
protected function getTestServiceSubscriberService() { return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber(); }
CWE-89
0
public function confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $swimlane, ))); }
CWE-639
9
public function clean() { $dataSourceConfig = ConnectionManager::getDataSource('default')->config; $dataSource = $dataSourceConfig['datasource']; if ($dataSource == 'Database/Mysql') { $sql = 'DELETE FROM bruteforces WHERE `expire` <= NOW();'; } elseif ($dataSource ==...
CWE-367
29
public function AddAddress($address, $name = '') { return $this->AddAnAddress('to', $address, $name); }
CWE-79
1
public function toolbar() { // global $user; $menu = array(); $dirs = array( BASE.'framework/modules/administration/menus', BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus' ); foreach ($dirs as $dir) { if (is_readable($dir)) { $dh = opendir($dir); while (...
CWE-89
0
public function display_sdm_upload_meta_box($post) { // File Upload metabox $old_upload = get_post_meta($post->ID, 'sdm_upload', true); $old_value = isset($old_upload) ? $old_upload : ''; _e('Manually enter a valid URL of the file in the text box below, or click "Select File" button to upload (or choose) the d...
CWE-79
1
public static function getTemplateHierarchyFlat($parent, $depth = 1) { global $db; $arr = array(); $kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank'); // $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC')); for ($i = 0, $i...
CWE-89
0
public function run() { if ($this->user->isCurrentUser() || \Yii::$app->user->isGuest) { return; } // Add class for javascript handling $this->followOptions['class'] .= ' followButton'; $this->unfollowOptions['class'] .= ' unfollowButton'; // Hide in...
CWE-79
1
public static function format($date, $format='') { $timezone = Options::v('timezone'); $time = strtotime($date); (empty($format))? $format = "j F Y H:i A T" : $format = $format; $date = new DateTime($date); $date->setTimezone(new DateTimeZone($timezone)); $newda...
CWE-89
0
public function __construct($mongo, array $options) { if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { throw new \InvalidArgumentException('MongoClient or Mongo instance required'); } if (!isset($options['database']) || !isset($options['collection'])) { ...
CWE-89
0
$contents = ['form' => tep_draw_form('countries', 'countries.php', 'page=' . $_GET['page'] . '&action=insert')];
CWE-79
1
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
public function matchesPath($requestPath) { $cookiePath = $this->getPath(); // Match on exact matches or when path is the default empty "/" if ($cookiePath == '/' || $cookiePath == $requestPath) { return true; } // Ensure that the cookie-path is a prefix of ...
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($row['TYPE'], strpos($row['TYPE'], '(')); ...
CWE-22
2
public function showall() { expHistory::set('viewable', $this->params); // figure out if should limit the results if (isset($this->params['limit'])) { $limit = $this->params['limit'] == 'none' ? null : $this->params['limit']; } else { $limit = (isset($this->co...
CWE-89
0
public function save() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { if ($this->categoryModel->create($values) !== false) { $this->f...
CWE-639
9
public function __construct() { }
CWE-89
0
function update_option_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $opt = new option_master($id); $oldtitle = $opt->title; $opt->update($this->params); // if the title of the master changed we should...
CWE-89
0
public function __construct($uri = '') { if ($uri != null) { $parts = parse_url($uri); if ($parts === false) { throw new \InvalidArgumentException("Unable to parse URI: $uri"); } $this->applyParts($parts); } }
CWE-89
0
public function updateFile(Attachment $attachment, $requestData) { $attachment->name = $requestData['name']; if (isset($requestData['link']) && trim($requestData['link']) !== '') { $attachment->path = $requestData['link']; if (!$attachment->external) { $th...
CWE-79
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-89
0
public function update() { //populate the alt tag field if the user didn't if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title']; // call expController update to save the image parent::update(); }
CWE-89
0
private function _includeFiles($files) { $dynamic_scripts = ""; $scripts = array(); foreach ($files as $value) { if (strpos($value['filename'], "?") !== false) { $dynamic_scripts .= "<script type='text/javascript' src='js/" . $value['filena...
CWE-79
1
function realCharForNumericEntities($matches) { $newstringnumentity = $matches[1]; if (preg_match('/^x/i', $newstringnumentity)) { $newstringnumentity = hexdec(preg_replace('/^x/i', '', $newstringnumentity)); } // The numeric value we don't want as entities if (($newstringnumentity >= 65 && $newstringnumentity...
CWE-79
1
public function saveUpdatedUpload(UploadedFile $uploadedFile, Attachment $attachment) { if (!$attachment->external) { $this->deleteFileInStorage($attachment); } $attachmentName = $uploadedFile->getClientOriginalName(); $attachmentPath = $this->putFileInStorage($uploa...
CWE-22
2
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
CWE-89
0
public function store() { $data = array( 'type_name' => $this->name ); try { if ($this->id !== null && $this->id > 0) { if ($this->old_name !== null) { $this->deleteTranslation($this->old_name); $this->addTra...
CWE-89
0
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
CWE-89
0
public static function publish($id) { $id = Typo::int($id); $ins = array( 'table' => 'posts', 'id' => $id, 'key' => array( 'status' => '1' ) ); $po...
CWE-89
0
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) { if ($is_revisioned) { $object->revision_id++; //if ($table=="text") eDebug($object); $res = $this->insertObject($object, $table); //if ($table=="text") eDebug($objec...
CWE-89
0
protected function defaultExtensions() { return [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'svg', 'js', 'map', 'ico', 'css', 'less', 'scss', ...
CWE-79
1
public static function recent($vars) { $catW = isset($vars['cat'])? " AND `cat` = '".$vars['cat']:""; $type = isset($vars['type'])? $vars['type']: "post"; $num = isset($vars['num'])? $vars['num']: "10"; $sql = "SELECT * FROM `posts` WHERE `type` = '{$type}' $ca...
CWE-89
0
public function testGetRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId) { $request = new Enlight_Controller_Request_RequestTestCase(); $request->setMethod('GET'); $response = new Enlight_Controller_Response_ResponseTestCase(); $request->setPathI...
CWE-601
11
public function getQueryGroupby() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return "$R2.id"; }
CWE-89
0
public static function optionsExist($var) { if (file_exists(GX_THEME.$var.'/options.php')) { return true; }else{ return false; } }
CWE-89
0
public function saveconfig() { 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']); $conf = serialize($calc->parseConfig($this->...
CWE-89
0
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
$contents = ['form' => tep_draw_form('testimonials', 'testimonials.php', 'page=' . $_GET['page'] . '&tID=' . $tInfo->testimonials_id . '&action=deleteconfirm')];
CWE-79
1
$sloc = expCore::makeLocation('navigation', null, $section->id); // remove any manage permissions for this page and it's children // $db->delete('userpermission', "module='navigationController' AND internal=".$section->id); // $db->delete('grouppermission', "module='na...
CWE-89
0
function advancedFilterSearch($queue, $filter) { global $database_ged; $datas = array(); if($filter == "description"){ echo json_encode($datas); return false; } $gedsql_result1=sqlrequest($database_ged,"SELECT pkt_type_id,pkt_type_name FROM pkt_type WHERE pkt_type_id!='0' AND pkt_type_id<'100';"); while...
CWE-78
6
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 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