code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
foreach ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); }
CWE-89
0
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_products WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); return $out; }
CWE-89
0
function render_menu_page() { echo '<div class="wrap">'; echo '<h2>'.__('Blacklist Manager','all-in-one-wp-security-and-firewall').'</h2>';//Interface title $this->set_menu_tabs(); $tab = $this->get_current_tab(); $this->render_menu_tabs(); ?> <div id="poststuff"><div id="post-body"> <?php //$tab_keys = array_keys($this->menu_tabs); call_user_func(array(&$this, $this->menu_tabs_handler[$tab])); ?> </div></div> </div><!-- end of wrap --> <?php }
CWE-79
1
private function validateCodeInjectionInMetadata() { if ( \function_exists('exif_read_data') && \in_array($this->getMimeType(), ['image/jpeg', 'image/tiff']) && \in_array(exif_imagetype($this->path), [IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM]) ) { $imageSize = getimagesize($this->path, $imageInfo); if ( $imageSize && (empty($imageInfo['APP1']) || 0 === strpos($imageInfo['APP1'], 'Exif')) && ($exifdata = exif_read_data($this->path)) && !$this->validateImageMetadata($exifdata) ) { throw new \App\Exceptions\DangerousFile('ERR_FILE_PHP_CODE_INJECTION'); } } }
CWE-79
1
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[$i]; if ($value == "''" && substr($string, -1) == '=') { $value = ' IS NULL'; $string = substr($string, 0, -1); } $string .= "$value"; if ($counter == ($array_count - 2) && $array_count % 2 == 0) $string .= " ELSE "; elseif ($counter == ($array_count - 1)) $string .= " END "; elseif ($counter % 2 == 0) $string .= " WHEN $array[0]="; elseif ($counter % 2 == 1) $string .= " THEN "; $counter++; } } return $string; }
CWE-79
1
function _makeChooseCheckbox($value, $title) { // return '<INPUT type=checkbox name=st_arr[] value=' . $value . ' checked>'; global $THIS_RET; return "<input name=unused[$THIS_RET[STUDENT_ID]] value=" . $THIS_RET[STUDENT_ID] . " type='checkbox' id=$THIS_RET[STUDENT_ID] onClick='setHiddenCheckboxStudents(\"st_arr[]\",this,$THIS_RET[STUDENT_ID]);' />"; }
CWE-22
2
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 if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
CWE-89
0
function output( $p_format = 'dot', $p_headers = false ) { # Check if it is a recognized format. if( !isset( $this->formats[$p_format] ) ) { trigger_error( ERROR_GENERIC, ERROR ); } $t_binary = $this->formats[$p_format]['binary']; $t_type = $this->formats[$p_format]['type']; $t_mime = $this->formats[$p_format]['mime']; # Send Content-Type header, if requested. if( $p_headers ) { header( 'Content-Type: ' . $t_mime ); } # Retrieve the source dot document into a buffer ob_start(); $this->generate(); $t_dot_source = ob_get_contents(); ob_end_clean(); # Start dot process $t_command = $this->graphviz_tool . ' -T' . $p_format; $t_descriptors = array( 0 => array( 'pipe', 'r', ), 1 => array( 'pipe', 'w', ), 2 => array( 'file', 'php://stderr', 'w', ), ); $t_pipes = array(); $t_process = proc_open( $t_command, $t_descriptors, $t_pipes ); if( is_resource( $t_process ) ) { # Filter generated output through dot fwrite( $t_pipes[0], $t_dot_source ); fclose( $t_pipes[0] ); if( $p_headers ) { # Headers were requested, use another output buffer to # retrieve the size for Content-Length. ob_start(); while( !feof( $t_pipes[1] ) ) { echo fgets( $t_pipes[1], 1024 ); } header( 'Content-Length: ' . ob_get_length() ); ob_end_flush(); } else { # No need for headers, send output directly. while( !feof( $t_pipes[1] ) ) { print( fgets( $t_pipes[1], 1024 ) ); } } fclose( $t_pipes[1] ); proc_close( $t_process ); } }
CWE-78
6
AND subtype IN ('.implode(",", array_map(function($k){ return protect($k);}, $subtypes)).')'
CWE-89
0
protected function Start() { $sCurrentStepClass = $this->sInitialStepClass; $oStep = new $sCurrentStepClass($this, $this->sInitialState); $this->DisplayStep($oStep); }
CWE-918
16
public static function v () { return self::$version." ".self::$v_release; }
CWE-89
0
$tableBody[] = array($row['label'], $row['nb_visits'], $row['bounce_rate']); if ($count == 10) break; } $this->table($tableHead, $tableBody, null); } }
CWE-79
1
$json_response = ['status' => 'error', 'message' => $e->getMessage()];
CWE-79
1
new SessionHandlerProxy(new \SessionHandler()) : new NativeProxy(); }
CWE-89
0
public function testAllowsForRelativeUri() { $uri = (new Uri)->withPath('foo'); $this->assertEquals('foo', $uri->getPath()); $this->assertEquals('foo', (string) $uri); }
CWE-89
0
$extraFields[] = ['field' => $rule->field, 'id' => $field_option['id']];
CWE-89
0
protected function parse() { parent::parse(); // grab the error-type from the parameters $errorType = $this->getParameter('type'); // set correct headers switch($errorType) { case 'module-not-allowed': case 'action-not-allowed': SpoonHTTP::setHeadersByCode(403); break; case 'not-found': SpoonHTTP::setHeadersByCode(404); break; } // querystring provided? if($this->getParameter('querystring') !== null) { // split into file and parameters $chunks = explode('?', $this->getParameter('querystring')); // get extension $extension = SpoonFile::getExtension($chunks[0]); // if the file has an extension it is a non-existing-file if($extension != '' && $extension != $chunks[0]) { // set correct headers SpoonHTTP::setHeadersByCode(404); // give a nice error, so we can detect which file is missing echo 'Requested file (' . implode('?', $chunks) . ') not found.'; // stop script execution exit; } } // assign the correct message into the template $this->tpl->assign('message', BL::err(SpoonFilter::toCamelCase(htmlspecialchars($errorType), '-'))); }
CWE-79
1
static function displayname() { return "Events"; }
CWE-89
0
public function localFileSystemSearchIteratorFilter($file, $key, $iterator) { if ($iterator->hasChildren()) { return (bool)$this->attr($key, 'read', null, true); } return ($this->stripos($file->getFilename(), $this->doSearchCurrentQuery) === false)? false : true; }
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); break; } // Error code for both. if ($connection === false) { switch ($DatabaseType) { case 'mysqli': $errormessage = mysqli_error($connection); break; } db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errormessage); } return $connection; }
CWE-79
1
public function testValidatesUriCanBeParsed() { new Uri('///'); }
CWE-89
0
public static function meta($cont_title='', $cont_desc='', $pre =''){ global $data; //print_r($data); //if(empty($data['posts'][0]->title)){ if(is_array($data) && isset($data['posts'][0]->title)){ $sitenamelength = strlen(Options::get('sitename')); $limit = 70-$sitenamelength-6; $cont_title = substr(Typo::Xclean(Typo::strip($data['posts'][0]->title)),0,$limit); $titlelength = strlen($data['posts'][0]->title); if($titlelength > $limit+3) { $dotted = "...";} else {$dotted = "";} $cont_title = "{$pre} {$cont_title}{$dotted} - "; }else{ $cont_title = ""; } if(is_array($data) && isset($data['posts'][0]->content)){ $desc = Typo::strip($data['posts'][0]->content); }else{ $desc = ""; } $meta = " <!--// Start Meta: Generated Automaticaly by GeniXCMS --> <!-- SEO: Title stripped 70chars for SEO Purpose --> <title>{$cont_title}".Options::get('sitename')."</title> <meta name=\"Keyword\" content=\"".Options::get('sitekeywords')."\"> <!-- SEO: Description stripped 150chars for SEO Purpose --> <meta name=\"Description\" content=\"".self::desc($desc)."\"> <meta name=\"Author\" content=\"Puguh Wijayanto | MetalGenix IT Solutions - www.metalgenix.com\"> <meta name=\"Generator\" content=\"GeniXCMS\"> <meta name=\"robots\" content=\"".Options::get('robots')."\"> <meta name=\"revisit-after\" content=\" days\"> <link rel=\"shortcut icon\" href=\"".Options::get('siteicon')."\" /> "; $meta .= " <!-- Generated Automaticaly by GeniXCMS :End Meta //-->"; echo $meta; }
CWE-89
0
public function testCanTransformAndRetrievePartsIndividually() { $uri = (new Uri('')) ->withFragment('#test') ->withHost('example.com') ->withPath('path/123') ->withPort(8080) ->withQuery('?q=abc') ->withScheme('http') ->withUserInfo('user', 'pass'); // Test getters. $this->assertEquals('user:[email protected]:8080', $uri->getAuthority()); $this->assertEquals('test', $uri->getFragment()); $this->assertEquals('example.com', $uri->getHost()); $this->assertEquals('path/123', $uri->getPath()); $this->assertEquals(8080, $uri->getPort()); $this->assertEquals('q=abc', $uri->getQuery()); $this->assertEquals('http', $uri->getScheme()); $this->assertEquals('user:pass', $uri->getUserInfo()); }
CWE-89
0
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)) { $this->flash->success(t('Swimlane updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { $errors = array('name' => array(t('Another swimlane with the same name exists in the project'))); } } return $this->edit($values, $errors); }
CWE-639
9
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'])) { $this->flash->success(t('Custom filter removed successfully.')); } else { $this->flash->failure(t('Unable to remove this custom filter.')); } $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); }
CWE-639
9
public function sendData($data) { $url = $this->getEndpoint().'?'.http_build_query($data, '', '&'); $httpRequest = $this->httpClient->get($url); $httpRequest->getCurlOptions()->set(CURLOPT_SSLVERSION, 6); // CURL_SSLVERSION_TLSv1_2 for libcurl < 7.35 $httpResponse = $httpRequest->send(); return $this->createResponse($httpResponse->getBody()); }
CWE-89
0
foreach ($days as $value) { $regitem[] = $value; }
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( $vendor->title, $vendor->table, $vendor->tablename, $vendor->classname, $vendor->identifier ); assign_to_template(array( 'vendor_title' => $vendor_title, 'vendor'=>$vendor )); } }
CWE-89
0
$section = new section($this->params); } else { notfoundController::handle_not_found(); exit; } if (!empty($section->id)) { $check_id = $section->id; } else { $check_id = $section->parent; } if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) { if (empty($section->id)) { $section->active = 1; $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); } else { // User does not have permission to manage sections. Throw a 403 notfoundController::handle_not_authorized(); } }
CWE-89
0
public function getRecordTitle($id) { if (isset($this->faqRecord['id']) && ($this->faqRecord['id'] == $id)) { return $this->faqRecord['title']; } $question = ''; $query = sprintf( "SELECT thema AS question FROM %sfaqdata WHERE id = %d AND lang = '%s'", PMF_Db::getTablePrefix(), $id, $this->_config->getLanguage()->getLanguage() ); $result = $this->_config->getDb()->query($query); if ($this->_config->getDb()->numRows($result) > 0) { while ($row = $this->_config->getDb()->fetchObject($result)) { $question = $row->question; } } else { $question = $this->pmf_lang['no_cats']; } return $question; }
CWE-79
1
$fontfile = self::_getfontpath().$file; } elseif (@file_exists($file)) { $fontfile = $file; } return $fontfile; }
CWE-502
15
static function displayname() { return gt("Navigation"); }
CWE-89
0
static public function compress_png($path, $max_quality = 85) { $check = shell_exec("pngquant --version"); if(!$check) { return false; }else{ // guarantee that quality won't be worse than that. $min_quality = 60; // '-' makes it use stdout, required to save to $compressed_png_content variable // '<' makes it read from the given file path // escapeshellarg() makes this safe to use with any path $compressed_png_content = shell_exec("pngquant --quality=$min_quality-$max_quality - < ".escapeshellarg($path)); if (!$compressed_png_content) { throw new Exception("Conversion to compressed PNG failed. Is pngquant 1.8+ installed on the server?"); }else{ file_put_contents($path, $compressed_png_content); return true; } } }
CWE-89
0
private function SearchFileContents() { $args = array(); $args[] = '-I'; $args[] = '--full-name'; $args[] = '--ignore-case'; $args[] = '-n'; $args[] = '-e'; $args[] = '"' . addslashes($this->search) . '"'; $args[] = $this->treeHash; $lines = explode("\n", $this->exe->Execute($this->project->GetPath(), GIT_GREP, $args)); foreach ($lines as $line) { if (preg_match('/^[^:]+:([^:]+):([0-9]+):(.+)$/', $line, $regs)) { if (isset($this->allResults[$regs[1]])) { $result = $this->allResults[$regs[1]]; $matchingLines = $result->GetMatchingLines(); $matchingLines[(int)($regs[2])] = trim($regs[3], "\n\r\0\x0B"); $result->SetMatchingLines($matchingLines); } else { $tree = $this->GetTree(); $hash = $tree->PathToHash($regs[1]); if ($hash) { $blob = $this->project->GetObjectManager()->GetBlob($hash); $blob->SetPath($regs[1]); $result = new GitPHP_FileSearchResult($this->project, $blob, $regs[1]); $matchingLines = array(); $matchingLines[(int)($regs[2])] = trim($regs[3], "\n\r\0\x0B"); $result->SetMatchingLines($matchingLines); $this->allResults[$regs[1]] = $result; } } } } }
CWE-78
6
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 ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . $node->name; } else { $text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')'; } $ar[$node->id] = $text; foreach (self::levelDropdownControlArray($node->id, $depth + 1, $ignore_ids, $full, $perm, $addstandalones, $addinternalalias) as $id => $text) { $ar[$id] = $text; } } }
CWE-89
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 successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
CWE-639
9
function init_args() { $args = new stdClass(); $args->req_id = isset($_REQUEST['requirement_id']) ? $_REQUEST['requirement_id'] : 0; $args->compare_selected_versions = isset($_REQUEST['compare_selected_versions']); $args->left_item_id = isset($_REQUEST['left_item_id']) ? intval($_REQUEST['left_item_id']) : -1; $args->right_item_id = isset($_REQUEST['right_item_id']) ? intval($_REQUEST['right_item_id']) : -1; $args->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $args->use_daisydiff = isset($_REQUEST['use_html_comp']); $diffEngineCfg = config_get("diffEngine"); $args->context = null; if( !isset($_REQUEST['context_show_all'])) { $args->context = (isset($_REQUEST['context']) && is_numeric($_REQUEST['context'])) ? $_REQUEST['context'] : $diffEngineCfg->context; } return $args; }
CWE-89
0
public function authenticate(CakeRequest $request, CakeResponse $response) { return self::getUser($request); }
CWE-502
15
function columnUpdate($table, $col, $val, $where=1) { $res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where"); /*if ($res == null) return array(); $objects = array(); for ($i = 0; $i < mysqli_num_rows($res); $i++) $objects[] = mysqli_fetch_object($res);*/ //return $objects; }
CWE-89
0
public function sdm_save_upload_meta_data($post_id) { // Save File Upload metabox if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; if (!isset($_POST['sdm_upload_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_upload_box_nonce_check'], 'sdm_upload_box_nonce')) return; if (isset($_POST['sdm_upload'])) { update_post_meta($post_id, 'sdm_upload', $_POST['sdm_upload']); } }
CWE-79
1
public function uploadImage() { $filesCheck = array_filter($_FILES); if (!empty($filesCheck) && $this->approvedFileExtension($_FILES['file']['name'], 'image') && strpos($_FILES['file']['type'], 'image/') !== false) { ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '10M'); $tempFile = $_FILES['file']['tmp_name']; $targetPath = $this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'userTabs' . DIRECTORY_SEPARATOR; $this->makeDir($targetPath); $targetFile = $targetPath . $_FILES['file']['name']; $this->setAPIResponse(null, pathinfo($_FILES['file']['name'], PATHINFO_BASENAME) . ' has been uploaded', null); return move_uploaded_file($tempFile, $targetFile); } }
CWE-79
1
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); $section->subtheme = $subtpl->subtheme; $section->active = $subtpl->active; $section->public = $subtpl->public; $section->rank = $subtpl->rank; $section->page_title = $subtpl->page_title; $section->keywords = $subtpl->keywords; $section->description = $subtpl->description; $section->id = $db->insertObject($section, 'section'); self::process_section($section, $subtpl); }
CWE-89
0
public static function sitemap() { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/sitemap".GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')."/index.php?page=sitemap"; break; } return $url; }
CWE-79
1
public function isActive() { if (PHP_VERSION_ID >= 50400) { return $this->active = \PHP_SESSION_ACTIVE === session_status(); } return $this->active; }
CWE-89
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'])) { $this->flash->success(t('Custom filter removed successfully.')); } else { $this->flash->failure(t('Unable to remove this custom filter.')); } $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); }
CWE-639
9
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 $key=>$d) { if ($d->id == $this->params['date_id']) $event_key = $key; } assign_to_template(array( 'allforms' => array_merge($allforms, expTemplate::buildNameList("forms", "event/email", "tpl", "[!_]*")), 'checked_date' => !empty($this->params['date_id']) ? $this->params['date_id'] : null, 'event_key' => $event_key, )); }
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 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_replace("�", "-", $str); $str = str_replace("�", "&#151;", $str); $str = str_replace("�", "&rdquo;", $str); $str = str_replace("�", "&ldquo;", $str); $str = str_replace("\r\n", " ", $str); //$str = str_replace(",","\,",$str); $str = str_replace('\"', "&quot;", $str); $str = str_replace('"', "&quot;", $str); $str = str_replace("�", "&#188;", $str); $str = str_replace("�", "&#189;", $str); $str = str_replace("�", "&#190;", $str); //$str = htmlspecialchars($str); //$str = utf8_encode($str); // if (DB_ENGINE=='mysqli') { // $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "&trade;", $str))); // } elseif(DB_ENGINE=='mysql') { // $str = @mysql_real_escape_string(trim(str_replace("�", "&trade;", $str)),$db->connection); // } else { // $str = trim(str_replace("�", "&trade;", $str)); // } $str = @expString::escape(trim(str_replace("�", "&trade;", $str))); //echo "2<br>"; eDebug($str,die); return $str; }
CWE-89
0
public function getQueryGroupby() { $R1 = 'R1_' . $this->id; $R2 = 'R2_' . $this->id; return "$R2.value"; }
CWE-89
0
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
CWE-89
0
public function __construct () { self::$myBlogName = Options::v('sitename'); self::$myBlogUrl = Options::v('siteurl'); self::$myBlogUpdateUrl = Options::v('siteurl'); self::$myBlogRSSFeedUrl = Url::rss(); }
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->purchase_order->find('all'); } assign_to_template(array( 'purchase_orders'=>$purchase_orders, 'vendors' => $vendors, 'vendor_id' => @$this->params['vendor'] )); }
CWE-89
0
protected function remove($path, $force = false) { $stat = $this->stat($path); if (empty($stat)) { return $this->setError(elFinder::ERROR_RM, $path, elFinder::ERROR_FILE_NOT_FOUND); } $stat['realpath'] = $path; $this->rmTmb($stat); $this->clearcache(); if (!$force && !empty($stat['locked'])) { return $this->setError(elFinder::ERROR_LOCKED, $this->path($stat['hash'])); } if ($stat['mime'] == 'directory' && empty($stat['thash'])) { $ret = $this->delTree($this->convEncIn($path)); $this->convEncOut(); if (!$ret) { return $this->setError(elFinder::ERROR_RM, $this->path($stat['hash'])); } } else { if ($this->convEncOut(!$this->_unlink($this->convEncIn($path)))) { return $this->setError(elFinder::ERROR_RM, $this->path($stat['hash'])); } $this->clearstatcache(); } $this->removed[] = $stat; return true; }
CWE-22
2
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( 'calculator'=>$calc )); }
CWE-89
0
public function uploadAvatar(Request $request) { $user = auth()->user(); if ($user && $request->hasFile('admin_avatar')) { $user->clearMediaCollection('admin_avatar'); $user->addMediaFromRequest('admin_avatar') ->toMediaCollection('admin_avatar'); } if ($user && $request->has('avatar')) { $data = json_decode($request->avatar); $user->clearMediaCollection('admin_avatar'); $user->addMediaFromBase64($data->data) ->usingFileName($data->name) ->toMediaCollection('admin_avatar'); } return new UserResource($user); }
CWE-434
5
public function __construct() { self::$key = Options::v('google_captcha_sitekey'); self::$secret = Options::v('google_captcha_secret'); self::$lang = Options::v('google_captcha_lang'); }
CWE-89
0
foreach ($post['fields'] as $abs_pos => $field) { if ($current_cat != $post[$field . '_category']) { //reset position when category has changed $pos = 0; //set new current category $current_cat = $post[$field . '_category']; } $required = null; if (isset($post[$field . '_required'])) { $required = $post[$field . '_required']; } else { $required = false; } $res[$current_cat][] = array( 'field_id' => $field, 'label' => $post[$field . '_label'], 'category' => $post[$field . '_category'], 'visible' => $post[$field . '_visible'], 'required' => $required ); $pos++; }
CWE-79
1
foreach ($fields as $field => $title) { if($i==0 && $j==0){ echo '<div class="row">'; }elseif($i==0 && $j>0){ echo '</div><div class="row">'; } echo '<div class="col-md-6"><label class="checkbox-inline"><INPUT type=checkbox onclick="addHTML(\'<LI>' . $title . '</LI>\',\'names_div\',false);addHTML(\'<INPUT type=hidden name=fields[' . $field . '] value=Y>\',\'fields_div\',false);addHTML(\'\',\'names_div_none\',true);this.disabled=true">' . $title . '<label></div>'; /*if ($i % 2 == 0) echo '</TR><TR>';*/ $i++; if($i==2){ $i = 0; } $j++; }
CWE-79
1
function access($attr, $path, $data, $volume) { return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot) ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true : null; // else elFinder decide it itself }
CWE-89
0
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)) { unset($evs[$key]); continue; } } $evs[$key]->eventstart += $edate->date; $evs[$key]->eventend += $edate->date; $evs[$key]->date_id = $edate->id; if (!empty($event->expCat)) { $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color); // if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';'; $evs[$key]->color = $catcolor; } }
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
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0
function import() { $pullable_modules = expModules::listInstalledControllers($this->baseclassname); $modules = new expPaginator(array( 'records' => $pullable_modules, 'controller' => $this->loc->mod, 'action' => $this->params['action'], 'order' => isset($this->params['order']) ? $this->params['order'] : 'section', 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '', 'page' => (isset($this->params['page']) ? $this->params['page'] : 1), 'columns' => array( gt('Title') => 'title', gt('Page') => 'section' ), )); assign_to_template(array( 'modules' => $modules, )); }
CWE-89
0
public static function type($id) { return Categories::type($id); }
CWE-89
0
function VerifyBlockedSchedule($columns,$course_period_id,$sec,$edit=false) { if($course_period_id!='new') { $cp_det_RET= DBGet(DBQuery("SELECT * FROM course_periods WHERE course_period_id=$course_period_id")); $cp_det_RET=$cp_det_RET[1]; $teacher=$cp_det_RET['TEACHER_ID']; $secteacher=$cp_det_RET['SECONDARY_TEACHER_ID']; $all_teacher=$teacher.($secteacher!=''?$secteacher:''); }
CWE-22
2
public function updatePreferences(Codendi_Request $request) { $request->valid(new Valid_String('cancel')); if (!$request->exist('cancel')) { $job_id = $request->get($this->widget_id . '_job_id'); $sql = "UPDATE plugin_hudson_widget SET job_id=" . $job_id . " WHERE owner_id = " . $this->owner_id . " AND owner_type = '" . $this->owner_type . "' AND id = " . (int) $request->get('content_id'); $res = db_query($sql); }
CWE-89
0
function scan($dir, $filter = '') { $path = FM_ROOT_PATH.'/'.$dir; $ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $rii = new RegexIterator($ite, "/(".$filter.")/i"); $files = array(); foreach ($rii as $file) { if (!$file->isDir()) { $fileName = $file->getFilename(); $location = str_replace(FM_ROOT_PATH, '', $file->getPath()); $files[] = array( "name" => $fileName, "type" => "file", "path" => $location, ); } } return $files; }
CWE-22
2
foreach ($events as $event) { $extevents[$date][] = $event; }
CWE-89
0
public function testPutRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId, $expectedCode) { $request = new Enlight_Controller_Request_RequestTestCase(); $request->setMethod('PUT'); $response = new Enlight_Controller_Response_ResponseTestCase(); $request->setPathInfo($uri); $this->router->assembleRoute($request, $response); static::assertEquals($expectedController, $request->getControllerName()); static::assertEquals($expectedAction, $request->getActionName()); static::assertEquals($expectedVersion, $request->getParam('version')); static::assertEquals($expectedId, $request->getParam('id')); static::assertEquals($expectedCode, $response->getHttpResponseCode()); }
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' => isset($this->params['order']) ? $this->params['order'] : 'section', 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '', 'page' => (isset($this->params['page']) ? $this->params['page'] : 1), 'columns' => array( gt('Title') => 'title', gt('Page') => 'section' ), )); assign_to_template(array( 'modules' => $modules, )); }
CWE-89
0
$opt .= "<option value=\"{$key}\" title=\"".htmlspecialchars($value)."\" {$sel}>".htmlspecialchars($value)."</option>"; } return $opt; }
CWE-89
0
unset($k, $v); } } return self::$user; }
CWE-502
15
echo '<LANGUAGE>' . htmlentities($value_arr['LANGUAGE']) . '</LANGUAGE>'; foreach ($value_arr['ENROLLMENT_INFO'] as $eid => $ed) { echo '<ENROLLMENT_INFO_' . htmlentities($eid) . '>'; echo '<SCHOOL_ID>' . htmlentities($ed['SCHOOL_ID']) . '</SCHOOL_ID>'; echo '<CALENDAR>' . htmlentities($ed['CALENDAR']) . '</CALENDAR>'; echo '<GRADE>' . htmlentities($ed['GRADE']) . '</GRADE>'; echo '<SECTION>' . htmlentities($ed['SECTION']) . '</SECTION>'; echo '<START_DATE>' . htmlentities($ed['START_DATE']) . '</START_DATE>'; echo '<DROP_DATE>' . htmlentities($ed['DROP_DATE']) . '</DROP_DATE>'; echo '<ENROLLMENT_CODE>' . htmlentities($ed['ENROLLMENT_CODE']) . '</ENROLLMENT_CODE>'; echo '<DROP_CODE>' . htmlentities($ed['DROP_CODE']) . '</DROP_CODE>'; echo '</ENROLLMENT_INFO_' . htmlentities($eid) . '>'; } echo '</STUDENT>'; } echo '</SCHOOL>'; }
CWE-22
2
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 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->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.')); // verify the id/key pair $sub = new subscribers($this->params['id']); if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.')); // get this users subscriptions $subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id); // get a list of all available E-Alerts $ealerts = new expeAlerts(); assign_to_template(array( 'subscriber'=>$sub, 'subscriptions'=>$subscriptions, 'ealerts'=>$ealerts->find('all') )); }
CWE-89
0
public static function getCookieValue($value) { if (substr($value, 0, 1) !== '"' && substr($value, -1, 1) !== '"' && strpbrk($value, ';,=') ) { $value = '"' . $value . '"'; } return $value; }
CWE-89
0
public static function handler($vars) { self::$vars(); }
CWE-89
0
public function showall() { expHistory::set('viewable', $this->params); $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) { $limit = '0'; } $order = isset($this->config['order']) ? $this->config['order'] : "rank"; $page = new expPaginator(array( 'model'=>'photo', 'where'=>$this->aggregateWhereClause(), 'limit'=>$limit, 'order'=>$order, 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'], 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'), 'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']), 'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null, 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title' ), )); assign_to_template(array( 'page'=>$page, 'params'=>$this->params, )); }
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
$attvalue = str_replace($quotchar, "", $attvalue); switch ($attname){ case 'background': $styledef .= "background-image: url('$trans_image_path'); "; break; case 'bgcolor': $has_bgc_stl = true; $styledef .= "background-color: $attvalue; "; break; case 'text': $has_txt_stl = true; $styledef .= "color: $attvalue; "; break; } } // Outlook defines a white bgcolor and no text color. This can lead to // white text on a white bg with certain themes. if ($has_bgc_stl && !$has_txt_stl) { $styledef .= "color: $text; "; } if (strlen($styledef) > 0){ $divattary{"style"} = "\"$styledef\""; } } return $divattary; }
CWE-89
0
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->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; } $order = isset($this->config['order']) ? $this->config['order'] : 'publish DESC'; // pull the news posts from the database $items = $this->news->find('all', $this->aggregateWhereClause(), $order); // merge in any RSS news and perform the sort and limit the number of posts we return to the configured amount. if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items); // setup the pagination object to paginate the news stories. $page = new expPaginator(array( 'records'=>$items, 'limit'=>$limit, 'order'=>$order, 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'view'=>empty($this->params['view']) ? null : $this->params['view'] )); assign_to_template(array( 'page'=>$page, 'items'=>$page->records, 'rank'=>($order==='rank')?1:0, 'params'=>$this->params, )); }
CWE-89
0
public function load_from_resultset($rs) { $main = $rs[0]; $this->id = $main->id; $this->website = $main->website; $this->title = $main->title; $this->file = $main->file; $this->sections = mb_unserialize($main->sections); $this->gallery = $main->gallery; $this->comments = $main->comments; $this->tags = $main->tags; $this->statistics = $main->statistics; $this->permission = $main->permission; $this->enabled = $main->enabled; }
CWE-22
2
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
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( $vendor->title, $vendor->table, $vendor->tablename, $vendor->classname, $vendor->identifier ); assign_to_template(array( 'vendor_title' => $vendor_title, 'vendor'=>$vendor )); } }
CWE-89
0
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
$contents = ['form' => tep_draw_form('classes', 'tax_classes.php', 'page=' . $_GET['page'] . '&action=insert')];
CWE-79
1
public static function exist ($vars) { if(file_exists(GX_THEME.THEME.'/'.$vars.'.php')) { return true; }else{ return false; } }
CWE-89
0
public function testIdExceptionPhp53() { if (PHP_VERSION_ID >= 50400) { $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } $this->proxy->setActive(true); $this->proxy->setId('foo'); }
CWE-89
0
public function insert() { global $DB; $ok = $DB->execute(' INSERT INTO nv_menus (id, codename, icon, lid, notes, functions, enabled) VALUES ( 0, :codename, :icon, :lid, :notes, :functions, :enabled)', array( 'codename' => value_or_default($this->codename, ""), 'icon' => value_or_default($this->icon, ""), 'lid' => value_or_default($this->lid, 0), 'notes' => value_or_default($this->notes, ""), 'functions' => json_encode($this->functions), 'enabled' => value_or_default($this->enabled, 0) ) ); if(!$ok) throw new Exception($DB->get_last_error()); $this->id = $DB->get_last_id(); return true; }
CWE-79
1
public function navigate_session() { global $website; global $user; global $DB; $fid = $_REQUEST['fid']; if(empty($fid)) $fid = 'dashboard'; $user_profile_name = $DB->query_single('name', 'nv_profiles', 'id='.protect($user->profile)); $this->add_content( '<div class="navigate-help">'. (empty($website->id)? '' : '<a class="navigate-plus-link" href="#" title="'.t(38, 'Create').'"><i class="fa fa-fw fa-plus"></i></span></a>'). //'<a class="navigate-favorites-link" href="#" title="'.t(465, 'Favorites').'"><i class="fa fa-fw fa-heart"></i></span></a>'. '<a class="navigate-help-link" title="'.t(302, 'Help').'" href="http://www.navigatecms.com/help?lang='.$user->language.'&fid='.$fid.'" target="_blank"><i class="fa fa-fw fa-question"></i></a>'. '<a class="navigate-logout-link" href="?logout" title="'.t(5, 'Logout').'"><i class="fa fa-fw fa-power-off"></i></span></a>'. '</div>'. '<div class="navigate-session">'. (empty($website->id)? '' : '<a href="#" id="navigate-recent-items-link"><div><span class="ui-icon ui-icon-triangle-1-s" style=" float: right; "></span><img src="img/icons/silk/briefcase.png" width="16px" height="16px" align="absmiddle" /> '.t(275, 'Recent items').'</div></a>').
CWE-89
0
realname: l.attr('data-realname'), firstname: l.attr('data-firstname') }); l.append(` <div class="member-details"> ${member_item} ${l.attr('data-name') || `${member_itemtype} (${member_items_id})`} </div> <button type="button" name="delete" class="btn btn-ghost-danger"> <i class="ti ti-x" title="${__('Delete')}"></i> </button> `); }); });
CWE-79
1
function comment_item($params) { if (!user_can_access('module.comments.index')) { return; } $data = array( 'id' => $params['comment_id'], 'single' => true, ); $comment = get_comments($data); if (!$comment) { return; } $view_file = $this->views_dir . 'comment_item.php'; $view = new View($view_file); $view->assign('params', $params); $view->assign('comment', $comment); return $view->display(); }
CWE-94
14
function wp_statistics_get_site_title( $url ) { //Get ody Page $html = wp_statistics_get_html_page( $url ); if ( $html === false ) { return false; } //Get Page Title if ( class_exists( 'DOMDocument' ) ) { $dom = new DOMDocument; @$dom->loadHTML( $html ); $title = ''; if ( isset( $dom ) and $dom->getElementsByTagName( 'title' )->length > 0 ) { $title = $dom->getElementsByTagName( 'title' )->item( '0' )->nodeValue; } return ( wp_strip_all_tags( $title ) == "" ? false : $title ); } return false; }
CWE-79
1
public static function email_verification($email, $hash) { global $DB; $status = false; if(strpos($hash, "-") > 0) { list($foo, $expiry) = explode("-", $hash); if(time() > $expiry) { // expired unconfirmed account! return $status; } } $DB->query(' SELECT id, activation_key FROM nv_webusers WHERE email = '.protect($email).' AND activation_key = '.protect($hash).' '); $rs = $DB->first(); if(!empty($rs->id)) { $wu = new webuser(); $wu->load($rs->id); // access is only enabled for blocked users (access==1) which don't have a password nor an email verification date if($wu->access==1 && empty($wu->password) && empty($wu->email_verification_date)) { // email is confirmed through a newsletter subscribe request $wu->email_verification_date = time(); $wu->access = 0; $wu->activation_key = ""; $status = $wu->save(); } } return $status; }
CWE-89
0
function get_is_file($dir, $item) { // can this file be edited? return @is_file(get_abs_item($dir,$item)); }
CWE-22
2
public function __construct() { }
CWE-89
0
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 ($sectionObj->parent == -1) { $current = $sectionObj; } else { foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } assign_to_template(array( 'sasections' => $db->selectObjects('section', 'parent=-1'), 'sections' => $navsections, 'current' => $current, 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0), )); }
CWE-89
0
public function buildControl() { $control = new colorcontrol(); if (!empty($this->params['value'])) $control->value = $this->params['value']; if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value']; $control->default = $this->params['value']; if (!empty($this->params['hide'])) $control->hide = $this->params['hide']; if (isset($this->params['flip'])) $control->flip = $this->params['flip']; $this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : ''; $control->name = $this->params['name']; $this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : ''; $control->id = isset($this->params['id']) && $this->params['id'] != "" ? $this->params['id'] : ""; //echo $control->id; if (empty($control->id)) $control->id = $this->params['name']; if (empty($control->name)) $control->name = $this->params['id']; // attempt to translate the label if (!empty($this->params['label'])) { $this->params['label'] = gt($this->params['label']); } else { $this->params['label'] = null; } echo $control->toHTML($this->params['label'], $this->params['name']); // $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code))); // $ar->send(); }
CWE-89
0
public function redirect($url) { if (trim($url) == '') { return false; } $url = str_ireplace('Location:', '', $url); $url = trim($url); $redirectUrl = site_url(); $parseUrl = parse_url($url); if (isset($parseUrl['host'])) { if ($parseUrl['host'] == site_hostname()) { $redirectUrl = $url; } } if (!filter_var($redirectUrl, FILTER_VALIDATE_URL)) { $redirectUrl = site_url(); } if (headers_sent()) { echo '<meta http-equiv="refresh" content="0;url=' . $redirectUrl . '">'; } else { return \Redirect::to($redirectUrl); } }
CWE-93
33
foreach ($value as $i => $j) { $column_check = explode('_', $i); if ($column_check[0] == 'CUSTOM') { $check_validity = DBGet(DBQuery('SELECT COUNT(*) as REC_EX FROM school_custom_fields WHERE ID=' . $column_check[1] . ' AND (SCHOOL_ID=' . $get_school_info[$key]['ID'].' OR SCHOOL_ID=0)')); if ($check_validity[1]['REC_EX'] == 0) $j = 'NOT_AVAILABLE_FOR'; } $get_school_info[$key][$i] = trim($j); }
CWE-79
1