code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
public function column_title( $post ) { list( $mime ) = explode( '/', $post->post_mime_type ); $title = _draft_or_post_title(); $thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) ); $link_start = $link_end = ''; if ( current_user_can( 'edit_post', $post->ID ) && ! $thi...
CWE-79
1
$db->insertObject($obj, 'expeAlerts_subscribers'); } $count = count($this->params['ealerts']); if ($count > 0) { flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.')); } else { ...
CWE-89
0
private function updateHostFromUri($host) { // Ensure Host is the first header. // See: http://tools.ietf.org/html/rfc7230#section-5.4 if ($port = $this->uri->getPort()) { $host .= ':' . $port; } $this->headerLines = ['Host' => [$host]] + $this->headerLines; ...
CWE-89
0
public static function group($id){ $usr = Db::result( sprintf("SELECT * FROM `user` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1", Typo::int($id), Typo::cleanX($id) ) ); return $usr[0]->group; }
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'...
CWE-79
1
header("Location: ".$this->makeLink(array('section'=>intval($_REQUEST['section']))),TRUE,301);
CWE-89
0
$result = sqlrequest($database_ged, $sql); if(!$result){ $success = false; } } // display the final message if($success){ message(11, " : ".getLabel("message.event_edited"), "ok"); } else { message(11, " : ".getLabel("message.event_edited_error"), "danger"); } }
CWE-78
6
public function breadcrumb() { global $sectionObj; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // Show not only the location of a page in the hierarchy but also the location of a standalone page $current = new secti...
CWE-89
0
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $m...
CWE-89
0
public function shouldRun(DateTime $date) { global $timedate; $runDate = clone $date; $this->handleTimeZone($runDate); $cron = Cron\CronExpression::factory($this->schedule); if (empty($this->last_run) && $cron->isDue($runDate)) { return true; } ...
CWE-89
0
public function withUserInfo($user, $password = null) { $info = $user; if ($password) { $info .= ':' . $password; } if ($this->userInfo === $info) { return $this; } $new = clone $this; $new->userInfo = $info; return $new; ...
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 _downloadErrorLog() { $tmpDir = TMP . 'logs' . DS; $Folder = new Folder($tmpDir); $files = $Folder->read(true, true, false); if (count($files[0]) === 0 && count($files[1]) === 0) { return false; } // ZIP圧縮して出力 $fileName = 'basercms_logs_' . date('Ymd_His'); $Simplezip = new Simpl...
CWE-78
6
private function createSink(StreamInterface $stream, array $options) { if (!empty($options['stream'])) { return $stream; } $sink = isset($options['sink']) ? $options['sink'] : fopen('php://temp', 'r+'); return is_string($sink) ? n...
CWE-89
0
public static function flagLib () { return "<link href=\"".Site::$url."/assets/css/flag-icon.min.css\" rel=\"stylesheet\">"; }
CWE-89
0
static function author() { return "Dave Leffler"; }
CWE-89
0
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.mp4', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.wps', '.ppt'...
CWE-79
1
public static function update($vars){ if(is_array($vars)){ $sql = array( 'table' => 'menus', 'id' => $vars['id'], 'key' => $vars['key'] ); $menu = Db::update($sql); } }...
CWE-89
0
$controller = new $ctlname(); if (method_exists($controller,'isSearchable') && $controller->isSearchable()) { // $mods[$controller->name()] = $controller->addContentToSearch(); $mods[$controller->searchName()] = $controller->addContentToSearch(); } } uksort($mods,'str...
CWE-89
0
function manage() { expHistory::set('viewable', $this->params); // $category = new storeCategory(); // $categories = $category->getFullTree(); // // // foreach($categories as $i=>$val){ // // if (!empty($this->values) && in_ar...
CWE-89
0
public function isAuthorizedBackendUserSession() { if (!$this->hasSessionCookie()) { return false; } $this->initializeSession(); if (empty($_SESSION['authorized']) || empty($_SESSION['isBackendSession'])) { return false; } return !$this->is...
CWE-613
7
static function lookup($var) { if (is_array($var)) return parent::lookup($var); elseif (is_numeric($var)) return parent::lookup(array('staff_id'=>$var)); elseif (Validator::is_email($var)) return parent::lookup(array('email'=>$var)); elseif (is_str...
CWE-89
0
public function invalidate() { $name = $this->getName(); if (null !== $name) { $params = session_get_cookie_params(); $cookie_options = array ( 'expires' => time() - 42000, 'path' => $params['path'], 'domain' => $par...
CWE-565
17
foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; }
CWE-89
0
public function urlOrExistingFilepath($fields) { if ($this->isFeedLocal($this->data)) { if ($this->data['Feed']['source_format'] == 'misp') { if (!is_dir($this->data['Feed']['url'])) { return 'For MISP type local feeds, please specify the containing direct...
CWE-502
15
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 successful...
CWE-639
9
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['r...
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']; ...
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
protected function _save($fp, $dir, $name, $stat) { //TODO optionally encrypt $fp before uploading if mime is not already encrypted type $path = $this->_joinPath($dir, $name); return $this->connect->put($path, $fp) ? $path : false; }
CWE-22
2
public function testUserCredentials($email, $password, $server, $port, $security) { require_once(realpath(Yii::app()->basePath.'/components/phpMailer/class.phpmailer.php')); require_once(realpath(Yii::app()->basePath.'/components/phpMailer/class.smtp.php')); $phpMail = new PHPMailer(true); ...
CWE-79
1
public function getFileIdentifiersInFolder($folderIdentifier, $useFilters = true, $recursive = false) { $filters = $useFilters == true ? $this->fileAndFolderNameFilters : []; return $this->driver->getFilesInFolder($folderIdentifier, 0, 0, $recursive, $filters); }
CWE-319
8
public function fetchSGOrgRow($id, $removable = false, $extend = false) { $this->layout = false; $this->autoRender = false; $this->set('id', $id); $this->set('removable', $removable); $this->set('extend', $extend); $this->render('ajax/sg_org_row_empty'); }
CWE-79
1
public function withCookieHeader(RequestInterface $request) { $values = []; $uri = $request->getUri(); $scheme = $uri->getScheme(); $host = $uri->getHost(); $path = $uri->getPath() ?: '/'; foreach ($this->cookies as $cookie) { if ($cookie->matchesPath...
CWE-89
0
protected function _joinPath($dir, $name) { $sql = 'SELECT id FROM '.$this->tbf.' WHERE parent_id="'.$dir.'" AND name="'.$this->db->real_escape_string($name).'"'; if (($res = $this->query($sql)) && ($r = $res->fetch_assoc())) { $this->updateCache($r['id'], $this->_stat($r['id'])); return $r['id']; } ret...
CWE-89
0
private function renderInvoice(InvoiceQuery $query, Request $request) { // use the current request locale as fallback, if no translation was configured if (null !== $query->getTemplate() && null === $query->getTemplate()->getLanguage()) { $query->getTemplate()->setLanguage($request->...
CWE-639
9
protected function _fclose($fp, $path='') { return @fclose($fp); }
CWE-89
0
public function showall() { global $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-...
CWE-89
0
$contentType = str_replace('data:', '', $cur); } } } else {
CWE-434
5
function readline(StreamInterface $stream, $maxLength = null) { $buffer = ''; $size = 0; while (!$stream->eof()) { // Using a loose equality here to match on '' and false. if (null == ($byte = $stream->read(1))) { return $buffer; } $buffer .= $byte; // Br...
CWE-89
0
static function activate($uid, $karmalevel = 'pear.dev') { require_once 'Damblan/Karma.php'; global $dbh, $auth_user; $karma = new Damblan_Karma($dbh); $user = user::info($uid, null, 0); if (!isset($user['registered'])) { return false; } @$a...
CWE-640
20
public function getHtmlForControlButtons() { $ret = ''; $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['navwork']) { $db = $this->realParent()->real_name; $item = $this->real_name; $ret = '<span class="navItemControls">' . ...
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 activate_discount(){ if (isset($this->params['id'])) { $discount = new discounts($this->params['id']); $discount->update($this->params); //if ($discount->discountulator->hasConfig() && empty($discount->config)) { //flash('messages', $di...
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
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
CWE-639
9
function get_current_tab() { $tab_keys = array_keys($this->menu_tabs); $tab = isset( $_GET['tab'] ) ? sanitize_text_field($_GET['tab']) : $tab_keys[0]; return $tab; }
CWE-79
1
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['r...
CWE-89
0
function cfdef_input_textbox( array $p_field_def, $p_custom_field_value, $p_required = '' ) { echo '<input ', helper_get_tab_index(), ' type="text" id="custom_field_', $p_field_def['id'] , '" name="custom_field_', $p_field_def['id'], '" ', $p_required; if( $p_field_def['length_max'] > 0 ) { echo ' maxlength="' ....
CWE-79
1
public static function getId($id=''){ if(isset($id)){ $sql = sprintf("SELECT * FROM `menus` WHERE `id` = '%d' ORDER BY `order` ASC", $id); $menus = Db::result($sql); $n = Db::$num_rows; }else{ $menus = ''; } return $menus; ...
CWE-89
0
protected function getShopByRequest(Request $request) { $repository = $this->get(ModelManager::class)->getRepository(Shop::class); $shop = null; if ($request->getPost('__shop') !== null) { $shop = $repository->getActiveById($request->getPost('__shop')); } if...
CWE-601
11
public static function rpc ($url) { new Pinger(); //require_once( GX_LIB.'/Vendor/IXR_Library.php' ); $url = 'http://'.$url; $client = new IXR_Client( $url ); $client->timeout = 3; $client->useragent .= ' -- PingTool/1.0.0'; $client->debug = false; ...
CWE-89
0
$ul->appendChild(new XMLElement('li', $s->get('navigation_group'))); $groups[] = $s->get('navigation_group'); }
CWE-79
1
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
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
CWE-89
0
public function getQueryGroupby() { // SubmittedOn is stored in the artifact return 'a.submitted_on'; }
CWE-89
0
public function checkCode($secret, $code, $discrepancy = 3) { /* $time = floor(time() / 30); for ($i = -1; $i <= 1; $i++) { if ($this->getCode($secret, $time + $i) == $code) { return true; } } */ $currentTimeSlice = floor(time() / ...
CWE-89
0
public function editTitle() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->title = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your title was updated succes...
CWE-89
0
public static function activate($id){ $act = Db::query( sprintf("UPDATE `user` SET `status` = '1' WHERE `id` = '%d'", Typo::int($id) ) ); if($act){ return true; }else{ return false; } }
CWE-89
0
protected function getFullPath($path, $base) { $separator = $this->separator; $systemroot = $this->systemRoot; $sepquoted = preg_quote($separator, '#'); // normalize `/../` $normreg = '#('.$sepquoted.')[^'.$sepquoted.']+'.$sepquoted.'\.\.'.$sepquoted.'#'; while(preg_match($normreg, $path)) { $path = p...
CWE-89
0
public static function unpublish($id) { $id = Typo::int($id); $ins = array( 'table' => 'posts', 'id' => $id, 'key' => array( 'status' => '0' ) ); $...
CWE-89
0
protected function prepareImport($model, $csvName) { $this->openX2 ('/admin/importModels?model='.ucfirst($model)); $csv = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'tests', 'data', 'csvs', $csvName )); $this-...
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 background($item_type, $item_id, $color) { global $DB; global $website; global $user; $DB->execute(' INSERT INTO nv_notes (id, website, user, item_type, item_id, background, note, date_created) VALUES ...
CWE-89
0
rsvpmaker_tx_email($post, $mail); } $send_confirmation = get_post_meta($post->ID,'_rsvp_rsvpmaker_send_confirmation_email',true); $confirm_on_payment = get_post_meta($post->ID,'_rsvp_confirmation_after_payment',true); if(($send_confirmation ||!is_numeric($send_confirmation)) && empty($confirm_on_payment) )//if it h...
CWE-89
0
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $m...
CWE-89
0
foreach ($val as $vkey => $value) { if ($vkey != 'LAST_UPDATED') { if ($vkey != 'UPDATED_BY') { if ($vkey == 'ID') echo '<SCHOOL_ID>' . htmlentities($value) . '</SCHOOL_ID>'; ...
CWE-79
1
static function getRSSFeed($url, $cache_duration = DAY_TIMESTAMP) { global $CFG_GLPI; $feed = new SimplePie(); $feed->set_cache_location(GLPI_RSS_DIR); $feed->set_cache_duration($cache_duration); // proxy support if (!empty($CFG_GLPI["proxy_name"])) { $prx_opt = []; ...
CWE-798
18
$chrootPath = realpath($chrootPath); if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) { $chrootValid = true; break; } } if ($chrootValid !== true) { ...
CWE-73
23
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
} elseif ($exception instanceof ErrorException) { $message = "{$exception->getName()}"; } else {
CWE-79
1
function sanitize_plural_expression($expr) { // Get rid of disallowed characters. $expr = preg_replace('@[^a-zA-Z0-9_:;\(\)\?\|\&=!<>+*/\%-]@', '', $expr); // Add parenthesis for tertiary '?' operator. $expr .= ';'; $res = ''; $p = 0; for ($i = 0; $i < strlen($expr); $i++) { $ch = $...
CWE-94
14
function ttValidDate($val) { $val = trim($val); if (strlen($val) == 0) return false; // This should accept a string in format 'YYYY-MM-DD', 'MM/DD/YYYY', 'DD-MM-YYYY', 'DD.MM.YYYY', or 'DD.MM.YYYY whatever'. if (!preg_match('/^\d\d\d\d-\d\d-\d\d$/', $val) && !preg_match('/^\d\d\/\d\d\/\d\d\d\d$/', $val...
CWE-79
1
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 static function remove($token){ $json = Options::v('tokens'); $tokens = json_decode($json, true); unset($tokens[$token]); $tokens = json_encode($tokens); if(Options::update('tokens',$tokens)){ return true; }else{ return false; ...
CWE-89
0
foreach ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); }
CWE-89
0
public static function gZip () { #ob_start(ob_gzhandler); ob_start(); ob_implicit_flush(0); }
CWE-89
0
public function confirm() { $task = $this->getTask(); $link_id = $this->request->getIntegerParam('link_id'); $link = $this->taskExternalLinkModel->getById($link_id); if (empty($link)) { throw new PageNotFoundException(); } $this->response->html($this...
CWE-639
9
public function __construct( $status = 200, array $headers = [], $body = null, $version = '1.1', $reason = null ) { $this->statusCode = (int) $status; if ($body !== null) { $this->stream = stream_for($body); } $this->setHeader...
CWE-89
0
}elseif($k2 == ''){ $va = ['default']; }else{
CWE-89
0
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
CWE-639
9
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
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 edit_freeform() { $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 getQueryOrderby() { return ''; }
CWE-89
0
$field_id = Symphony::Database()->fetchVar('id', 0, sprintf( "SELECT `f`.`id` FROM `tbl_fields` AS `f`, `tbl_sections` AS `s` WHERE `s`.`id` = `f`.`parent_section` AND f.`element_name` = '%s' AND `s`.`handle` = '%s' LIMIT 1", $handle, $section->get('handle')) );...
CWE-79
1
public function testResolvesUris($base, $rel, $expected) { $uri = new Uri($base); $actual = Uri::resolve($uri, $rel); $this->assertEquals($expected, (string) $actual); }
CWE-89
0
public static function rss() { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/rss".GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')."/index....
CWE-79
1
public function handle($request, Closure $next) { $checkCart = cart_get_items_count(); if (!$checkCart) { //$shop_page = get_content('single=true&content_type=page&is_shop=1'); $shop_page = app()->content_repository->getFirstShopPage(); $redir = site_url();...
CWE-79
1
public function getHeader() { $html = '<meta charset="utf-8"> <title>'.$this->getTitle().'</title> <meta name="description" content="">'; $html .= '<link href="'.$this->getStaticUrl('css/bootstrap.css').'" rel="stylesheet"> <link href="'.$this->ge...
CWE-79
1
public static function name($id) { return Categories::name($id); }
CWE-89
0
public function getModel() { return $this->model; }
CWE-79
1
public function getImage($id){ $url = "http://api.themoviedb.org/3/movie/{$id}/images?api_key=".$this->apikey; $cast = $this->curl($url); return $cast; }
CWE-89
0
public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) { $this->host = $host; // If no port value is passed, retrieve it if ($port == false) { $this->port = $this->POP3_PORT; } else { $this->port = $port; } // If no port value is...
CWE-79
1
function edit($selected_events, $queue) { global $database_ged; // get all needed infos into variables $value_parts = explode(":", $selected_events); $id = $value_parts[0]; $ged_type = $value_parts[1]; $sql = "SELECT comments FROM ".$ged_type."_queue_".$queue." WHERE id = $id"; $result = sqlrequest($database_g...
CWE-78
6
public function getUserList() { $result = []; $users = CodeModel::all(User::tableName(), 'nick', 'nick', false); foreach ($users as $codeModel) { if ($codeModel->code != 'admin') { $result[$codeModel->code] = $codeModel->description; } } ...
CWE-79
1
public function showall() { expHistory::set('viewable', $this->params); $hv = new help_version(); //$current_version = $hv->find('first', 'is_current=1'); $ref_version = $hv->find('first', 'version=\''.$this->help_version.'\''); // pagination parameter..hard coded for now. $where = ...
CWE-89
0
public function __construct($message = null, $code = 0, Exception $previous = null) { if ($message === null) { $message = _('Authentication required'); } parent::__construct($message, $code, $previous); }
CWE-307
26
public function enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully...
CWE-639
9