code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
CWE-89
0
print "<option value='" . $device['id'] . "'"; if (get_request_var('host_id') == $device['id']) { print ' selected'; } print '>' . title_trim(htmlspecialchars($device['description'] . ' (' . $device['hostname'] . ')'), 40) . "</option>\n"; } } ?> </select> </td> <?php } else {
CWE-79
1
public static function totalPost($vars) { $posts = Db::result("SELECT `id` FROM `posts` WHERE `type` = '{$vars}'"); $npost = Db::$num_rows; return $npost; }
CWE-89
0
function captureAuthorization() { //eDebug($this->params,true); $order = new order($this->params['id']); /*eDebug($this->params); //eDebug($order,true);*/ //eDebug($order,true); //$billing = new billing(); //eDebug($billing, true); //$billing->calcul...
CWE-89
0
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); $ret = @rename($source, $target) ? $target : false; $ret && clearstatcache(); return $ret; }
CWE-89
0
public function handle($request, Closure $next) { /** @var \Barryvdh\Debugbar\LaravelDebugbar $debugbar */ $debugbar = $this->app['debugbar']; try { return $next($request); } catch (\Exception $ex) { if (!\Request::ajax()) { throw $...
CWE-532
28
public function testStartedOutside() { $storage = $this->getStorage(); $this->assertFalse($storage->getSaveHandler()->isActive()); $this->assertFalse($storage->isStarted()); session_start(); $this->assertTrue(isset($_SESSION)); if (PHP_VERSION_ID >= 50400) { ...
CWE-89
0
function testCommandCategorieExistence ($name = NULL) { global $pearDB, $form; $id = NULL; if (isset($form)) $id = $form->getSubmitValue('cmd_category_id'); $DBRESULT = $pearDB->query("SELECT `category_name`, `cmd_category_id` FROM `command_categories` WHERE `category_name` = '".htmlentities($name, EN...
CWE-89
0
public function create($data) { if ($this->securityController->isWikiHibernated()) { throw new \Exception(_t('WIKI_IN_HIBERNATION')); } // If ID is not set or if it is already used, find a new ID if (!$data['bn_id_nature'] || $this->getOne($data['bn_id_nature'])) { ...
CWE-89
0
function edit_externalalias() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages ...
CWE-89
0
public function getQueryGroupby() { return "a.per_tracker_artifact_id"; }
CWE-89
0
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
CWE-79
1
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 offset($offset) { $this->ar_offset = $offset; return $this; }
CWE-89
0
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-89
0
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
CWE-639
9
public function __construct(Database $database, $cookiePrefix = '') { parent::__construct($database, TBL_SESSIONS, 'ses'); // determine session id if (array_key_exists(COOKIE_PREFIX . '_SESSION_ID', $_COOKIE)) { $sessionId = $_COOKIE[COOKIE_PREFIX . '_SESSION_ID']; }...
CWE-613
7
public function test_attachment_updating() { $page = Page::first(); $this->asAdmin(); $this->call('POST', 'attachments/link', [ 'attachment_link_url' => 'https://example.com', 'attachment_link_name' => 'Example Attachment Link', 'attachment_link_uploa...
CWE-79
1
function edit_internalalias() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages ...
CWE-89
0
public function show($image_name) { $imageFile = storage_path('app/'.str_replace("-","/",$image_name)); if(!is_file($imageFile)){ abort(404); } $image = Image::make($imageFile); if(config('tipask.upload.open_watermark') && $image_name != config('tipask.up...
CWE-494
22
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['requi...
CWE-89
0
function __construct () { }
CWE-89
0
$method = $this->request->get('_method', $this->query->get('_method', 'POST')); if (\is_string($method)) { $this->method = strtoupper($method); } } } }
CWE-79
1
public static function load() { $op = Db::result("SELECT * FROM `options` ORDER BY `id` ASC"); if(Db::$num_rows > 0){ return $op; }else{ return false; } }
CWE-89
0
protected function _joinPath($dir, $name) { return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name; }
CWE-22
2
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$str); $str = str_replace("&quot;",'"',$str); $str = str_replace("&#39;","'",$str); ...
CWE-89
0
private static function logoutAction() { if (wCMS::$currentPage === 'logout' && hash_equals($_REQUEST['token'], wCMS::generateToken())) { unset($_SESSION['l'], $_SESSION['i'], $_SESSION['u'], $_SESSION['token']); wCMS::redirect(); } }
CWE-22
2
public static function webuser_comments_count($webuser_id) { global $DB; global $website; $DB->query(' SELECT COUNT(*) AS total FROM nv_comments WHERE website = '.protect($website->id).' AND user = '.protect($webuser_id).' ...
CWE-89
0
public function save_change_password() { global $user; $isuser = ($this->params['uid'] == $user->id) ? 1 : 0; if (!$user->isAdmin() && !$isuser) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } ...
CWE-89
0
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
CWE-89
0
public function updateTab($id, $array) { if (!$id || $id == '') { $this->setAPIResponse('error', 'id was not set', 422); return null; } if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $tabInfo = $this->getTabById($id); if ($tabInfo) { $array = $this->c...
CWE-79
1
public function testPrintAction() { $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $fixture = new InvoiceTemplateFixtures(); $templates = $this->importFixture($fixture); $id = $templates[0]->getId(); $begin = new \DateTime('first day of this month'...
CWE-639
9
function prepareInputForUpdate($input) { if (isset($input["rootdn_passwd"])) { if (empty($input["rootdn_passwd"])) { unset($input["rootdn_passwd"]); } else { $input["rootdn_passwd"] = Toolbox::encrypt(stripslashes($input["rootdn_passwd"]), ...
CWE-798
18
public static function remove_all($object_type, $object_id) { global $DB; global $website; $DB->execute(' DELETE FROM nv_notes WHERE website = '.protect($website->id).' AND item_type = '.protect($object_type).' AND...
CWE-89
0
}elseif($k == "error"){ self::error($v); }elseif(!in_array($k, $arr) && $k != 'paging'){
CWE-89
0
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-639
9
function VerifyVariableSchedule_Update($columns) { // $teacher=$columns['TEACHER_ID']; // $secteacher=$columns['SECONDARY_TEACHER_ID']; // if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='') // { // $all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); //...
CWE-22
2
static function displayname() { return gt("e-Commerce Category Manager"); }
CWE-89
0
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
CWE-79
1
self::ajax($v); } else { if (in_array($k, $arr)) { self::incFront($k, $var); } else { self::error('404'); } } } }
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
function manage() { global $db, $router, $user; expHistory::set('manageable', $router->params); assign_to_template(array( 'canManageStandalones' => self::canManageStandalones(), 'sasections' => $db->selectObjects('section', 'parent=-1'), ...
CWE-89
0
function delete_selected() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item && $item->is_recurring == 1) { $event_remaining = false; $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id); foreach ($eventdates as ...
CWE-89
0
public static function type($id) { $id = sprintf('%d', $id); if(isset($id)){ $cat = Db::result("SELECT `type` FROM `cat` WHERE `id` = '{$id}' LIMIT 1"); //print_r($cat); if(isset($cat['error'])){ return ''; ...
CWE-89
0
private function getStateId(string $state, string $machine) { return $this->getContainer()->get(Connection::class) ->fetchColumn(' SELECT LOWER(HEX(state_machine_state.id)) FROM state_machine_state INNER JOIN state_machine ...
CWE-918
16
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 get($id) { if (!is_numeric($id)) { $this->errors[] = _T("ID must be an integer!"); return false; } try { $select = $this->zdb->select($this->table); $select->where($this->fpk . '=' . $id); $results = $this->zdb...
CWE-89
0
private function runCallback() { foreach ($this->records as &$record) { if (isset($record->ref_type)) { $refType = $record->ref_type; if (class_exists($record->ref_type)) { $type = new $refType(); $classinfo = new Reflection...
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
protected function _mkfile($path, $name) { if ($this->tmp) { $path = $this->_joinPath($path, $name); $local = $this->getTempFile(); $res = touch($local) && ftp_put($this->connect, $path, $local, FTP_ASCII); @unlink($local); return $res ? $path : false; } return false; }
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 update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { ...
CWE-639
9
function manage() { global $db, $router, $user; expHistory::set('manageable', $router->params); assign_to_template(array( 'canManageStandalones' => self::canManageStandalones(), 'sasections' => $db->selectObjects('section', 'parent=-1'), ...
CWE-89
0
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar');
CWE-78
6
public function admin_add() { $this->pageTitle = __d('baser', 'テーマアップロード'); $this->subMenuElements = ['themes']; if (!$this->request->is(['post', 'put'])) { return; } if ($this->Theme->isOverPostSize()) { $this->BcMessage->setError( __d( 'baser', '送信できるデータ量を超えています。合計で %s 以内のデータを送信してください...
CWE-78
6
public function renameUser($new_name) { // Rename only if a new name is really new if ($this->userName != $new_name) { // Save old name $old_name = $this->userName; // Rename user $this->userName = $new_name; $this->save(); ...
CWE-79
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-639
9
public function routeGetProvider() { return [ ['/api/articles/', 1, 'articles', 'index', false], ['/api/v1/articles/', 1, 'articles', 'index', false], ['/api/v2/articles/', 2, 'articles', 'index', false], ['/api/articles/5', 1, 'articles', 'get', 5], ...
CWE-601
11
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
function display($output=false) { if ($this->isEmpty()) return '(empty)'; switch ($output) { case 'email': return $this->body; case 'pdf': return Format::clickableurls($this->body); default: return Format::display($this->body, ...
CWE-918
16
private function resize($src, $srcImgInfo, $maxWidth, $maxHeight, $quality, $preserveExif) { $zoom = min(($maxWidth/$srcImgInfo[0]),($maxHeight/$srcImgInfo[1])); $width = round($srcImgInfo[0] * $zoom); $height = round($srcImgInfo[1] * $zoom); if (class_exists('Imagick', false)) { return $this->resize_ima...
CWE-89
0
public function transferPage() { //FIXME Put Import code in here. }
CWE-89
0
private function mail_passthru($to, $subject, $body, $header, $params) { if ( ini_get('safe_mode') || !($this->UseSendmailOptions) ) { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header); } else { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subjec...
CWE-79
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-639
9
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0
public static function getList () { $handle = dir(GX_PATH.'/inc/lang/'); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $file = GX_PATH.'/inc/lang/'.$entry; $ext = pathinfo($file, PATHINFO_EXTENSION); ...
CWE-89
0
if ($current_realm_id == -1 || is_realm_allowed($current_realm_id) || !isset($user_auth_realm_filenames{basename($item_url)})) { /* draw normal (non sub-item) menu item */ $item_url = $config['url_path'] . $item_url; if (is_menu_pick_active($item_url)) { print "<li><a role='menuitem' class...
CWE-79
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-639
9
public function __construct () { Session::start(); self::config('config'); new Db(); new Hooks(); Hooks::run('init'); new Options(); self::lang(Options::v('system_lang')); new Language(); new Site(); new Router(); V...
CWE-89
0
private function isFromTrustedProxy() { return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies); }
CWE-89
0
function display($text, $inline_images=true, $balance=true) { // Make showing offsite images optional $text = preg_replace_callback('/<img ([^>]*)(src="http[^"]+")([^>]*)\/>/', function($match) { // Drop embedded classes -- they don't refer to ours $match ...
CWE-918
16
function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) { if (empty($endtimestamp)) { $date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($timestamp) . ")"; } else {...
CWE-89
0
public function chapterToContainedHtml(Chapter $chapter) { $pages = $chapter->getVisiblePages(); $pages->each(function ($page) { $page->html = (new PageContent($page))->render(); }); $html = view('chapters.export', [ 'chapter' => $chapter, 'pag...
CWE-79
1
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-79
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-639
9
public function approve_toggle() { global $history; if (empty($this->params['id'])) return; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $r...
CWE-89
0
public function testSetCallbackNonCallable() { $response = new StreamedResponse(null); $response->setCallback(null); }
CWE-89
0
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
CWE-89
0
public static function mod($var) { self::load($var); }
CWE-89
0
function comments_list($params) { if (!user_can_access('module.comments.index')) { return; } if (!isset($params['content_id'])) { if (isset($params['rel_id']) and isset($params['rel_type'])) { $data = array( 'rel_id' => $para...
CWE-94
14
} elseif ($part != '.') { $depath++; }
CWE-22
2
public function params() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) { $this->create(); return; } $action = $this->act...
CWE-639
9
public function get_bitly () { $file = urldecode (join ('/', func_get_args ())); $link = $this->controller->absolutize ('/files/' . $file); return BitlyLink::lookup ($link); }
CWE-434
5
$this->headers = ['host' => [$host]] + $this->headers;
CWE-89
0
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ;
CWE-798
18
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
CWE-639
9
foreach ($val as $vkey => $value) { if ($vkey != 'LAST_UPDATED') { if ($vkey != 'UPDATED_BY') { if ($vkey == 'ID') echo '<SCHOOL_ID>' . htmlentities($value) . '</SCHOOL_ID>'; ...
CWE-22
2
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
CWE-89
0
public function showImage(string $path) { $path = storage_path('uploads/images/' . $path); if (!file_exists($path)) { throw (new NotFoundException(trans('errors.image_not_found'))) ->setSubtitle(trans('errors.image_not_found_subtitle')) ->setDetails(tr...
CWE-22
2
public function __construct( CartService $cartService, SalesChannelRepositoryInterface $productRepository, PromotionItemBuilder $promotionItemBuilder, ProductLineItemFactory $productLineItemFactory ) { $this->cartService = $cartService; $this->productRepository = ...
CWE-79
1
public function params() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) { $this->create(); return; } $action = $this->act...
CWE-639
9
self::removeLevel($kid->id); } }
CWE-89
0
function GenerateCryptKey($size = "", $secure = false, $numerals = false, $capitalize = false, $ambiguous = false, $symbols = false) { // load library $pwgen = new SplClassLoader('Encryption\PwGen', '../includes/libraries'); $pwgen->register(); $pwgen = new Encryption\PwGen\pwgen(); // init if ...
CWE-434
5
public static function paginated_list($offset, $limit, $order_by_field, $order_by_ascdesc) { global $DB; global $website; $DB->queryLimit( '*', 'nv_block_groups', 'website = '.protect($website->id), $order_by_field.' '.$order_by_ascd...
CWE-89
0
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
CWE-89
0
public function event() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id'])) { return $this->create(); } return $this->response->html($this->template->render('action_creat...
CWE-639
9
$cfgSite->setSetting( 'db', $key, $value); } $cfgSite->setSetting( 'site', 'secrethash', substr(md5(time() . ":" . mt_rand()),0,10)); return true; } else { return $Errors; } }
CWE-916
34
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 static function is_email($vars){ if(isset($_GET['act']) && $_GET['act'] == 'edit'){ $id = Typo::int($_GET['id']); $where = "AND `id` != '{$id}' "; }else{ $where = ''; } $vars = sprintf('%s', Typo::cleanX($vars)); $s...
CWE-89
0