code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
function delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->par...
CWE-89
0
$that->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['expiry_field']]['$lt']->sec); }));
CWE-89
0
protected function secure(Hostname $hostname, Request $request) { $this->emitEvent(new Secured($hostname)); return $this->redirect->secure($request->getRequestUri()); }
CWE-601
11
foreach ($value as $k => $val) { if ($k != 'LAST_UPDATED') { if ($k != 'UPDATED_BY') { if ($k == 'ID') $data['data'][$i]['SCHOOL_ID'] = $val; else if ($k == 'SYEAR') ...
CWE-22
2
public static function totalCat($vars) { $posts = Db::result("SELECT `id` FROM `cat` WHERE `type` = '{$vars}'"); $npost = Db::$num_rows; return $npost; }
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
public function update() { //populate the alt tag field if the user didn't if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title']; // call expController update to save the image parent::update(); }
CWE-89
0
foreach($course_RET as $period_day) { $period_days_append_sql .="(sp.start_time<='$period_day[END_TIME]' AND '$period_day[START_TIME]'<=sp.end_time AND DAYS LIKE '%$period_day[DAYS]%') OR "; }
CWE-79
1
$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 (expPer...
CWE-89
0
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Acti...
CWE-639
9
public static function inc ($vars, $data = "") { $file = GX_PATH.'/gxadmin/inc/'.$vars.'.php'; if (file_exists($file)) { include($file); } }
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
protected function AddAnAddress($kind, $address, $name = '') { if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { $this->SetError($this->Lang('Invalid recipient array').': '.$kind); if ($this->exceptions) { throw new phpmailerException('Invalid recipient array: ' . $kind); } if ...
CWE-79
1
protected function configure() { // set ARGS $this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST'? $_POST : $_GET; // set thumbnails path $path = $this->options['tmbPath']; if ($path) { if (!file_exists($path)) { if (@mkdir($path)) { chmod($path, $this->options['tmbPathMode']); } else { $...
CWE-89
0
public static function json() { $token = Options::v('tokens'); $token = json_decode($token, true); $newtoken = array( TOKEN => array( 'time' => TOKEN_TIME, 'ip' => TOKEN_IP, 'ur...
CWE-89
0
public function delete() { global $user; $count = $this->address->find('count', 'user_id=' . $user->id); if($count > 1) { $address = new address($this->params['id']); if ($user->isAdmin() || ($user->id == $address->user_id)) { if ($address->is_bill...
CWE-89
0
public function handleRequest() { /* Load error handling class */ $this->loadErrorHandler(); $this->modx->invokeEvent('OnHandleRequest'); /* save page to manager object. allow custom actionVar choice for extending classes. */ $this->action = isset($_REQUEST[$this->actionVar...
CWE-79
1
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 function load_template() { global $DB; global $website; $template = new template(); if( $this->association == 'free' || ($this->association == 'category' && $this->embedding == '0')) { $template->load($this->template); } else { $category_template = $DB->query_sing...
CWE-89
0
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-639
9
public function validateForField(App\Request $request) { $fieldModel = Vtiger_Module_Model::getInstance($request->getModule())->getFieldByName($request->getByType('fieldName', 2)); if (!$fieldModel || !$fieldModel->isActiveField() || !$fieldModel->isViewEnabled()) { throw new \App\Exceptions\NoPermitted('ERR_N...
CWE-434
5
function update_vendor() { $vendor = new vendor(); $vendor->update($this->params['vendor']); expHistory::back(); }
CWE-89
0
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
CWE-89
0
public function offset($value) { $this->offset = max(0, $value); return $this; }
CWE-22
2
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 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'] == 'show...
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
function exception_for($reason) { return $reason instanceof \Exception ? $reason : new RejectionException($reason); }
CWE-89
0
public function addTab($array) { if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $array = $this->checkKeys($this->getTableColumnsFormatted('tabs'), $array); $array['group_id'] = ($array['group_id']) ?? $this->getDefaultGroupId(); $array['category_id'] = ($array['...
CWE-79
1
protected function execute(InputInterface $input, OutputInterface $output) { /** @psalm-suppress PossiblyNullReference */ $command = $this->getApplication()->find('db:check'); $arguments = array( 'command' => 'db:check', ); $cmdInput = new ArrayInput($argume...
CWE-307
26
function createWhereClause($owner, $filter, $search, $daterange, $ok, $warning, $critical, $unknown) { $where_clause = ""; // owner if($owner == "owned"){ $where_clause .= " AND owner != ''"; } elseif($owner == "not owned"){ $where_clause .= " AND owner = ''"; } // advanced search (with *) if($search != ""){ ...
CWE-78
6
protected function _filePutContents($path, $content) { if (@file_put_contents($path, $content, LOCK_EX) !== false) { clearstatcache(); return true; } return false; }
CWE-89
0
function phoromatic_quit_if_invalid_input_found($input_keys = null) { if(empty($input_keys)) { // Check them all if not being selective about what keys to check $input_keys = array_keys($_REQUEST); } // backup as to sanitization and stripping elsewhere, safeguard namely check for things like < for fields that s...
CWE-79
1
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; }
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 configure() { expHistory::set('editable', $this->params); // little bit of trickery so that that categories can have their own configs $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $pu...
CWE-89
0
self::removeLevel($kid->id); } }
CWE-89
0
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
CWE-22
2
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
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); $...
CWE-89
0
public function Quit($close_on_error = true) { $this->error = null; // so there is no confusion if(!$this->connected()) { $this->error = array( "error" => "Called Quit() without being connected"); return false; } // send the quit command to the server fputs($this->smtp_...
CWE-79
1
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 setBaseUri(Response $response) { $response->headers->set('Content-Security-Policy', 'base-uri \'self\'', false); }
CWE-79
1
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'paren...
CWE-89
0
function delete() { global $db; if (empty($this->params['id'])) return false; $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']); $product = new $product_type($this->params['id'], true, false); //eDebug($product_type); //eDebug...
CWE-89
0
public function rules() { $ignore = Rule::unique('users')->ignore($this->id ?? 0, 'id'); return [ 'email' => [ $ignore, ], 'username' => [ $ignore, ], ]; }
CWE-190
19
private function getCriterionValue($value) { if ($value instanceof \AbstractQuery) { return $value->getQuery(); } else if ($value instanceof \QueryExpression) { return $value->getValue(); } else if (DBmysql::isNameQuoted($value)) { //FIXME: database related return $value;...
CWE-89
0
public static function textEncode( $mix ) { if ( is_array( $mix ) ) return implode(',', array_map( array('ezjscAjaxContent', 'textEncode'), array_filter( $mix ) ) ); return $mix; }
CWE-79
1
static function validUTF($string) { if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { return false; } return true; }
CWE-89
0
public static function post($vars) { switch (SMART_URL) { case true: $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php/":"/"; if (Options::v('multilang_enable') === 'on') { $lang = Language::isActive(); ...
CWE-89
0
recyclebin::sendToRecycleBin($loc, $parent); //FIXME if we delete the module & sectionref the module completely disappears // if (class_exists($secref->module)) { // $modclass = $secref->module; // //FIXME: more module/controller glue code // ...
CWE-89
0
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webuser_groups WHERE website = '.protect($website->id), 'object'); $out = $DB->resul...
CWE-89
0
function getFontSize() { $fs = $GLOBALS['PMA_Config']->get('fontsize'); if (!is_null($fs)) { return $fs; } if (isset($_COOKIE['pma_fontsize'])) { return $_COOKIE['pma_fontsize']; } return '82%'; }
CWE-79
1
public function delete() { global $db; /* 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['require_login']) ? COMMENTS_REQUIRE_LO...
CWE-89
0
$ip = getenv('HTTP_FORWARDED'); } else { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; }
CWE-89
0
protected function getStatusCode($exception) { if ($exception instanceof HttpExceptionInterface) { $code = $exception->getStatusCode(); } elseif ($exception instanceof AjaxException) { $code = 406; } else { $code = 500; ...
CWE-532
28
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
protected function gdImage($image, $filename, $destformat, $mime, $jpgQuality = null ){ if (!$jpgQuality) { $jpgQuality = $this->options['jpgQuality']; } if ($destformat == 'jpg' || ($destformat == null && $mime == 'image/jpeg')) { return imagejpeg($image, $filename, $jpgQuality); } if ($destformat =...
CWE-89
0
public function addTab($array) { if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $array = $this->checkKeys($this->getTableColumnsFormatted('tabs'), $array); $array['group_id'] = ($array['group_id']) ?? $this->getDefaultGroupId(); $array['category_id'] = ($array['...
CWE-79
1
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_re...
CWE-89
0
foreach ($fields as $field) { $fieldName = $field->fieldName; if ($field->type == 'date' || $field->type == 'dateTime') { if (is_numeric($record->$fieldName)) $record->$fieldName = Formatter::formatLongDateTime($record->$fieldName);...
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 StartTLS() { $this->error = null; # to avoid confusion if(!$this->connected()) { $this->error = array("error" => "Called StartTLS() without being connected"); return false; } fputs($this->smtp_conn,"STARTTLS" . $this->CRLF); $rply = $this->get_lines(); $code = su...
CWE-79
1
public function setAuthorizedBackendSession() { $_SESSION['authorized'] = true; $_SESSION['lastSessionId'] = time(); $_SESSION['tstamp'] = time(); $_SESSION['expires'] = time() + $this->expireTimeInMinutes * 60; $_SESSION['isBackendSession'] = true; // Renew the s...
CWE-613
7
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name); if (!$view) { // unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child $attr = new stdClass(); $attr->class = 'hidde...
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-78
6
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 static function scrap($param) { if ($param != '') { foreach ($param as $k => $v) { if (is_array($v)) { foreach ($v as $k2 => $v2) { $data[$k2] = $v2; } }else{ ...
CWE-89
0
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
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['r...
CWE-89
0
public function admin () { User::secure(); System::gZip(); if( User::access(2) ) { System::versionCheck(); Control::handler('backend'); }else{ Theme::admin('header'); Control::error('noaccess'); Theme::admin('footer...
CWE-89
0
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 setModelAttributes(&$model,&$attributeList,&$params) { $data = array (); foreach($attributeList as &$attr) { if(!isset($attr['name'],$attr['value'])) continue; if(null !== $field = $model->getField($attr['name'])) { // first do...
CWE-79
1
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
CWE-89
0
public function insert($ip, $username) { $this->Log = ClassRegistry::init('Log'); $this->Log->create(); $expire = time() + Configure::read('SecureAuth.expire'); $expire = date('Y-m-d H:i:s', $expire); $bruteforceEntry = array( 'ip' => $ip, 'usernam...
CWE-367
29
public function fetchRow($sql) { // retrieve row $query_id = $this->query($sql); $record = mysql_fetch_row($this->query_id); $this->freeResult($query_id); return $record; }#-#fetchArray()
CWE-89
0
function categoryBreadcrumb() { // global $db, $router; //eDebug($this->category); /*if(isset($router->params['action'])) { $ancestors = $this->category->pathToNode(); }else if(isset($router->params['section'])) { $current = $db->select...
CWE-89
0
function db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($ro...
CWE-79
1
public function getPurchaseOrderByJSON() { 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'); } echo json_encode($purchase_orders); }
CWE-89
0
public function renderAttribute ($name) { switch ($name) { case 'name': echo $this->relatedModel->getLink (/*array ( 'class' => 'quick-read-link', 'data-id' => $this->relatedModel->id, 'data-class' => get_class ($this->r...
CWE-79
1
public function edit(Request $request, $id) { return $this->view('post::admin.posts.edit', [ 'content_id'=>$id ]); }
CWE-79
1
return !isset($thisstaff) || $f->isRequiredForStaff(); }; if (!$form->isValid($filter)) $valid = false; //Make sure the email is not in-use if (($field=$form->getField('email')) && $field->getClean() && User::lookup(array('emails_...
CWE-1236
12
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')); ...
CWE-79
1
public function getTrackingId() { if(isset($this->ectid)) return $this->ectid; else return ''; }
CWE-89
0
public function check(&$params){ $tags = $this->config['options']['tags']['value']; $tags = is_array($tags) ? $tags : Tags::parseTags($tags, true); if(!empty($tags) && isset($params['tags'])){ // Check passed params to be sure they're set if(!is_array($params['tags'])){ ...
CWE-79
1
public function __construct() { $this->options['alias'] = ''; // alias to replace root dir name $this->options['dirMode'] = 0755; // new dirs mode $this->options['fileMode'] = 0644; // new files mode $this->options['quarantine'] = '.quarantine'; // quarantine folder name...
CWE-89
0
protected function _fopen($path, $mode='rb') { if (($mode == 'rb' || $mode == 'r')) { try { $res = $this->dropbox->media($path); $url = parse_url($res['url']); $fp = stream_socket_client('ssl://'.$url['host'].':443'); fputs($fp, "GET {$url['path']} HTTP/1.0\r\n"); fputs($fp, "Host: {$url['...
CWE-89
0
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "addresses as a "; //R J...
CWE-89
0
public function __construct () { }
CWE-89
0
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
CWE-89
0
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
CWE-89
0
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
CWE-79
1
public function get() { $r = '<div class="title gallery_div">'.$this->stack_name.'</div>'; for ($i = 0; $i < count($this->tiles_array); $i++) { $top = rand(-5, 5); $left = rand(-5, 5); $img_w = $this->tiles_array[$i]->getWidth(); $extra = ''; if ($img_w < IMAGE_WIDTH) { $extra = 'width:'.$img_w....
CWE-79
1
function preview() { if ($this->params['id'] == 0) { // we want the default editor $demo = new stdClass(); $demo->id = 0; $demo->name = "Default"; if ($this->params['editor'] == 'ckeditor') { $demo->skin = 'kama'; } elseif ($thi...
CWE-89
0
function MAX_adRenderImageBeacon($logUrl, $beaconId = 'beacon', $userAgent = null) { if (!isset($userAgent) && isset($_SERVER['HTTP_USER_AGENT'])) { $userAgent = $_SERVER['HTTP_USER_AGENT']; } $beaconId .= '_{random}'; // Add beacon image for logging if (isset($userAgent) && preg_match("#Moz...
CWE-79
1
public function remove() { $project = $this->getProject(); $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { ...
CWE-639
9
public function setContainer($container) { $this->container = $container; $container->setType('ctBanner'); }
CWE-79
1
public function confirm() { $task = $this->getTask(); $link = $this->getTaskLink(); $this->response->html($this->template->render('task_internal_link/remove', array( 'link' => $link, 'task' => $task, ))); }
CWE-639
9
function critere_where_dist($idb, &$boucles, $crit) { $boucle = &$boucles[$idb]; if (isset($crit->param[0])) { $_where = calculer_liste($crit->param[0], $idb, $boucles, $boucle->id_parent); } else { $_where = '@$Pile[0]["where"]'; } if ($crit->cond) { $_where = "(($_where) ? ($_where) : '')"; } if ($crit...
CWE-89
0
public function getQueryGroupby() { return "a.id"; }
CWE-89
0