code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
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 getQueryGroupby() { $R = 'R_' . $this->id; return "$R.value_id"; }
CWE-89
0
public function destroy($sessionId) { $this->getCollection()->remove(array( $this->options['id_field'] => $sessionId, )); return true; }
CWE-89
0
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
public function testPostRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId) { $request = new Enlight_Controller_Request_RequestTestCase(); $request->setMethod('POST'); $response = new Enlight_Controller_Response_ResponseTestCase(); $request->setPat...
CWE-601
11
function import() { $pullable_modules = expModules::listInstalledControllers($this->baseclassname); $modules = new expPaginator(array( 'records' => $pullable_modules, 'controller' => $this->loc->mod, 'action' => $this->params['action'], 'order' ...
CWE-89
0
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-89
0
public function getQuerySelect() { $R1 = 'R1_' . $this->id; $R2 = 'R2_' . $this->id; return "$R2.value AS `" . $this->name . "`"; }
CWE-89
0
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_files WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); ...
CWE-89
0
static function displayname() { return "Events"; }
CWE-89
0
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
CWE-639
9
public static function add($tags) { $tag = explode(",", $tags); foreach ($tag as $t) { if (self::exist($t)) { return false; }else{ $slug = Typo::slugify(Typo::cleanX($t)); $cat = Typo::cleanX($t); $tag ...
CWE-89
0
public function getBoolean($key, $default = false, $deep = false) { return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN, array(), $deep); }
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
public function from($dirName) { $this->from = $dirName; return $this; }
CWE-79
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-89
0
function phoromatic_webui_header($left_items, $right = null) { $ret = PHP_EOL . '<div id="pts_phoromatic_top_header"> <ul> <li><a href="?"><img style="vertical-align: middle;" class="img_logo_pg" src="images/phoromatic_logo.svg" /></a>'; if(isset($_SESSION['AdminLevel']) &&$_SESSION['AdminLevel'] > 0 && isset($_SE...
CWE-79
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException()...
CWE-639
9
public static function checkPermissions($permission,$location) { global $exponent_permissions_r, $router; // only applies to the 'manage' method if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($...
CWE-89
0
protected function itemLocked($hash) { if (!elFinder::$commonTempPath) { return false; } $lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock'; if (file_exists($lock)) { if (filemtime($lock) + $this->itemLockExpire < time()) { ...
CWE-918
16
form_end_row(); $i++; } html_end_box(false); /* print "<pre>"; if (isset($check) && is_array($check)) { print_r($check); } print "</pre>"; */ }
CWE-79
1
public function tmb($hash) { $path = $this->decode($hash); $stat = $this->stat($path); if (isset($stat['tmb'])) { return $stat['tmb'] == "1" ? $this->createTmb($path, $stat) : $stat['tmb']; } return false; }
CWE-89
0
public function getQuerySelect() { return ''; }
CWE-89
0
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
CWE-22
2
foreach ($events as $event) { $extevents[$date][] = $event; }
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 approvedFileExtension($filename, $type = 'image') { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if ($type == 'image') { switch ($ext) { case 'gif': case 'png': case 'jpeg': case 'jpg': case 'svg': return true; default: return false; } } els...
CWE-434
5
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
CWE-307
26
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-94
14
public function addTags($tags) { $result = false; $addedTags = array(); foreach ((array) $tags as $tagName) { if (empty($tagName)) continue; if (!in_array($tagName, $this->getTags())) { // check for duplicate tag $tag = new Tags; ...
CWE-79
1
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
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 __invoke(Request $request) { $this->authorize('manage modules'); $path = ModuleInstaller::unzip($request->module, $request->path); return response()->json([ 'success' => true, 'path' => $path ]); }
CWE-502
15
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException()...
CWE-639
9
public static function object_votes_by_webuser($object, $object_id, $orderby='date desc', $offset=0, $limit=PHP_INT_MAX) { global $DB; global $website; $DB->queryLimit('wuv.id AS id, wuv.date AS date, wuv.webuser AS webuser, wu.username AS username', 'nv_webuser_votes wuv, nv_webusers wu', ...
CWE-89
0
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
CWE-639
9
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
CWE-639
9
static function author() { return "Dave Leffler"; }
CWE-89
0
public function edit(Request $request, $id) { return $this->view('content::admin.content.edit', [ 'content_id'=>$id ]); }
CWE-79
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-639
9
public static function delParam($param, $post_id) { $sql = "DELETE FROM `posts_param` WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' LIMIT 1"; $q = Db::query($sql); if ($q) { return true; }else{ return false; } }
CWE-89
0
public static function cat($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".$vars."/".Typo::slugify(Categories::name($vars)); break; default: # code... $u...
CWE-89
0
private function encloseForCSV($field) { return '"' . cleanCSV($field) . '"'; }
CWE-640
20
public static function addParam($param, $value, $post_id) { $sql = array( 'table' => 'posts_param', 'key' => array( 'post_id' => $post_id, 'param' => $param, 'value' => $value )...
CWE-89
0
public function authenticate_by_email($website, $email, $password) { global $DB; // find the webuser username assigned to an email address // because it may exist more than one account with the same email, // only the first _created_ will be used $username = $DB->q...
CWE-89
0
protected function decodeData($data) { if ($this->base64encode) { if (is_string($data)) { if (($data = base64_decode($data)) !== false) { $data = @unserialize($data); } else { $data = null; } } else { $data = null; } } return $data; }
CWE-89
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-89
0
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_structure WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); return $o...
CWE-89
0
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-89
0
public function &storeicms_ipf_Object($debug=false, $xparam = false) { $ret =& $this->storeFromDefaultForm('', '', null, $debug, $xparam); return $ret; }
CWE-22
2
public function testRedirectLinkGeneration () { Yii::app()->controller = new MarketingController ( 'campaign', new MarketingModule ('campaign', null)); $_SERVER['SERVER_NAME'] = 'localhost'; $cmb = $this->instantiate(); $contact = $this->contacts('testUser_unsent'); ...
CWE-79
1
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestService...
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-22
2
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
public function getEditLanguageLink($icmsObj, $onlyUrl=false, $withimage=true) { $ret = $this->handler->_moduleUrl . "admin/" . $this->handler->_page . "?op=mod&amp;" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName) . "&amp;language=" . $icmsObj->getVar('language'); if ($on...
CWE-22
2
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-89
0
$result = $search->getSearchResults($item->query, false, true); if(empty($result) && !in_array($item->query, $badSearchArr)) { $badSearchArr[] = $item->query; $badSearch[$ctr2]['query'] = $item->query; $badSearch[$ctr2]['count'] = $db->countObjects("search_queries", "query='{$item->query}'"); $ct...
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
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
CWE-79
1
public function handleObjectDeletion($confirm_msg = false, $op='del', $userSide=false) { global $impresscms; $objectid = (isset($_REQUEST[$this->handler->keyName])) ? (int) $_REQUEST[$this->handler->keyName] : 0; $icmsObj = $this->handler->get($objectid); if ($icmsObj->isNew()) { redirect_header("j...
CWE-22
2
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 setUp() { parent::setUp(); $mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient'; $this->mongo = $this->getMockBuilder($mongoClass) ->disableOriginalConstructor() ->getMock(); $this->options = arra...
CWE-89
0
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-89
0
private function invertedSection($nodes, $id, $filters, $level) { $method = $this->getFindMethod($id); $id = var_export($id, true); $filters = $this->getFilters($filters, $level); return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $...
CWE-1336
30
protected function _move($source, $targetDir, $name) { $sql = 'UPDATE %s SET parent_id=%d, name="%s" WHERE id=%d LIMIT 1'; $sql = sprintf($sql, $this->tbf, $targetDir, $this->db->real_escape_string($name), $source); return $this->query($sql) && $this->db->affected_rows > 0 ? $source : false; }
CWE-89
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-89
0
public static function cat($vars) { switch (SMART_URL) { case true: # code... $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":""; $url = Site::$url.$inFold."/category/".$vars."/".Typo::slugify(Categories::name($vars)); ...
CWE-89
0
public function transformAssignedTo($asset) { if ($asset->checkedOutToUser()) { return $asset->assigned ? [ 'id' => (int) $asset->assigned->id, 'username' => e($asset->assigned->username), 'name' => e($asset->assigned->getFullNameAt...
CWE-79
1
function get_allowed_files_extensions_for_upload($fileTypes = 'images', $returnAsArray = false) { $are_allowed = ''; switch ($fileTypes) { case 'img': case 'image': case 'images': $are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg,webp,ico'; ...
CWE-79
1
public function getQuerySelect() { $R = 'R_' . $this->id; return "$R.value_id AS `" . $this->name . "`"; }
CWE-89
0
private function add_timeout(RequestInterface $request, &$options, $value, &$params) { $options['http']['timeout'] = $value; }
CWE-89
0
public function redeemable($cart, $webuser) { global $website; global $DB; // 1/ coupon matches the current website $redeemable = true; if($this->website != $website->id) $redeemable = false; // 2/ coupon currency matches the current cart...
CWE-89
0
public function admin_maintenance($mode = '') { $this->_checkReferer(); switch($mode) { case 'backup': set_time_limit(0); $this->_backupDb($this->request->query['backup_encoding']); break; case 'restore': set_time_limit(0); $messages = []; if (!$this->request->data) { if ($this-...
CWE-78
6
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
CWE-89
0
private function checkDecode(array $options, array $headers, $stream) { // Automatically decode responses when instructed. if (!empty($options['decode_content'])) { $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); if (isset($normalizedKeys['content-encoding'...
CWE-89
0
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ;
CWE-502
15
$count += $db->dropTable($basename); } flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.'); expHistory::back(); }
CWE-89
0
public function __construct(BufferingLogger $bootstrappingLogger = null) { if ($bootstrappingLogger) { $this->bootstrappingLogger = $bootstrappingLogger; $this->setDefaultLogger($bootstrappingLogger); } $this->traceReflector = new \ReflectionProperty('Exception', ...
CWE-209
31
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
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
CWE-89
0
public function beforeFilter() { // TODO REMOVE parent::beforeFilter(); $this->Security->unlockedActions = array('saveElementSorting', 'populateEventFromTemplate', 'uploadFile', 'deleteTemporaryFile'); }
CWE-94
14
function delete_vendor() { global $db; if (!empty($this->params['id'])){ $db->delete('vendor', 'id =' .$this->params['id']); } expHistory::back(); }
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['requi...
CWE-89
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-89
0
function PMA_findExistingColNames($db, $cols, $allFields=false) { $cfgCentralColumns = PMA_centralColumnsGetParams(); if (empty($cfgCentralColumns)) { return array(); } $pmadb = $cfgCentralColumns['db']; $GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']); $central_list_table = $c...
CWE-89
0
public function prepare( $query, $args ) { if ( is_null( $query ) ) return; // This is not meant to be foolproof -- but it will catch obviously incorrect usage. if ( strpos( $query, '%' ) === false ) { _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'w...
CWE-89
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-89
0
public static function insert ($vars) { if(is_array($vars)){ $set = ""; $k = ""; foreach ($vars['key'] as $key => $val) { $set .= "'$val',"; $k .= "`$key`,"; } $set = substr($set, 0,-1); $k =...
CWE-79
1
public function getQueryGroupby() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return "$R2.user_id"; }
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
function updateProfile($data) { global $bigtree; foreach ($data as $key => $val) { if (substr($key,0,1) != "_" && !is_array($val)) { $$key = sqlescape($val); } } $id = sqlescape($this->ID); if ($data["password"]) { $phpass = new PasswordHash($bigtree["config"]["password_depth"], TRU...
CWE-79
1
public static function lib($var) { $file = GX_LIB.$var.'.class.php'; if (file_exists($file)) { include($file); } }
CWE-89
0
public function testOpen() { $this->mock->expects($this->once()) ->method('open') ->will($this->returnValue(true)); $this->assertFalse($this->proxy->isActive()); $this->proxy->open('name', 'id'); if (PHP_VERSION_ID < 50400) { $this->assertTrue...
CWE-89
0
public static function deactivate($mod){ $mods = Options::v('modules'); $mods = json_decode($mods, true); if (!is_array($mods) || $mods == "") { $mods = array(); } //print_r($mods); $arr = ""; for ($i=0;$i<count($mods);$i++) { ...
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
private static function sesKey() { $ip = $_SERVER['REMOTE_ADDR']; $browser = $_SERVER['HTTP_USER_AGENT']; $dt = date("Y-m-d H"); $key = md5($ip.$browser.$dt); return $key; }
CWE-89
0
public static function isAnimationGif($path) { list($width, $height, $type, $attr) = getimagesize($path); switch ($type) { case IMAGETYPE_GIF: break; default: return false; } $imgcnt = 0; $fp = fopen($path, 'rb'); @fread($fp, 4); $c = @fread($fp,1); if (ord($c) != 0x39) { // GIF89a ...
CWE-89
0
protected function get_remote_contents(&$url, $timeout = 30, $redirect_max = 5, $ua = 'Mozilla/5.0', $fp = null) { if (preg_match('~^(?:ht|f)tps?://[-_.!\~*\'()a-z0-9;/?:\@&=+\$,%#\*\[\]]+~i', $url)) { $info = parse_url($url); $host = strtolower($info['host']); // do ...
CWE-918
16
}elseif(!in_array($k, $arr) && $k != 'paging'){ //self::error('404'); }else{ self::incFront('default'); } } }else{
CWE-89
0
public function onLoadRecord() { $scheduleCode = post('recordId'); $scheduleItem = $this->getSchedule($scheduleCode); $formTitle = sprintf(lang($this->formTitle), lang('admin::lang.text_'.$scheduleCode)); return $this->makePartial('recordeditor/form', [ 'formRecordI...
CWE-79
1