code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
function initEnv() { $iParams = array("reqURI" => array(tlInputParameter::STRING_N,0,4000)); $pParams = G_PARAMS($iParams); $args = new stdClass(); $args->ssodisable = getSSODisable(); // CWE-79: // Improper Neutralization of Input // During Web Page Generation ('Cross-site Scripting') // // ht...
Base
1
public function initializeObject() { $this->initializeFormStateFromRequest(); $this->initializeCurrentPageFromRequest(); if (!$this->isFirstRequest()) { $this->processSubmittedFormValues(); } }
Class
2
function insertObject($object, $table) { //if ($table=="text") eDebug($object,true); $sql = "INSERT INTO `" . $this->prefix . "$table` ("; $values = ") VALUES ("; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an ...
Base
1
function getDeviceID($useRandomString = true) { $ip = md5(getRealIpAddr()); if (empty($_SERVER['HTTP_USER_AGENT'])) { $device = "unknowDevice-{$ip}"; $device .= '-' . intval(User::getId()); return $device; } if (empty($useRandomString)) { $device = 'ypt-' . get_browser_n...
Base
1
public function dump($value) { $dumper = $this->getDumper(); if ($dumper) { // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump. // exclude verbose information (e.g. exception stack traces) if (class_exists('Sy...
Base
1
public function editAlt() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->alt = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your alt was updated succ...
Base
1
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; } ...
Base
1
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
Class
2
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)) { ...
Base
1
public function showUnpublished() { expHistory::set('viewable', $this->params); // setup the where clause for looking up records. $where = parent::aggregateWhereClause(); $where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where; ...
Base
1
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDef...
Base
1
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); ...
Class
2
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
$bool = self::evaluateTypedCondition($array, $expression); if (!$bool) { $hit->parentNode->removeChild($hit); } else { $hit->removeAttribute('n-if'); } } return $doc->saveHTML(); }
Variant
0
self::removeLevel($kid->id); } }
Class
2
public function saveconfig() { 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']); $conf = serialize($calc->parseConfig($this->...
Base
1
function XMLRPCremoveUserGroupPriv($name, $affiliation, $nodeid, $permissions){ require_once(".ht-inc/privileges.php"); global $user; if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)){ return array('status' => 'error', 'errorcode' => 53, 'errormsg' => 'Unabl...
Class
2
function selectObjectBySql($sql) { //$logFile = "C:\\xampp\\htdocs\\supserg\\tmp\\queryLog.txt"; //$lfh = fopen($logFile, 'a'); //fwrite($lfh, $sql . "\n"); //fclose($lfh); $res = @mysqli_query($this->connection, $sql); if ($res == null) ...
Base
1
public function __construct(){ }
Base
1
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,n...
Base
1
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
Base
1
public function gc($force = false) { if ($force || mt_rand(0, 1000000) < $this->gcProbability) { $this->db->createCommand() ->delete($this->cacheTable, '[[expire]] > 0 AND [[expire]] < ' . time()) ->execute(); } }
Class
2
protected function parseImageUrlWithPath( $article ) { $imageUrl = ''; if ( $article instanceof \DPL\Article ) { if ( $article->mNamespace == NS_FILE ) { // calculate URL for existing images // $img = Image::newFromName($article->mTitle->getText()); $img = wfFindFile( \Title::makeTitle( NS_FILE, $ar...
Class
2
public function confirm() { $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, 'filt...
Base
1
public function delete($fileName = null) { $this->validateFileName(); list($name, $extension) = $this->model->getFileNameParts(); return $this->datasource->delete( $this->model->getObjectTypeDirName(), $name, $extension ); }
Base
1
public function approve_toggle() { global $history; if (empty($this->params['id'])) return; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $r...
Base
1
public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response) { if (\strpos((string) $response->getStatusCode(), '3') !== 0 || !$response->hasHeader('Location') ) { return $response; } $this->guardMax($request, $res...
Class
2
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...
Class
2
public function AddAddress($address, $name = '') { return $this->AddAnAddress('to', $address, $name); }
Base
1
public function comments_count() { global $DB; if(empty($this->_comments_count)) { $DB->query(' SELECT COUNT(*) as total FROM nv_comments WHERE website = ' . protect($this->website) . ' ...
Base
1
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
Base
1
public function testAuthCheckToken() { $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL'; $GLOBALS['cfg']['Server']['SignonSession'] = 'session123'; $GLOBALS['cfg']['Server']['host'] = 'localhost'; $GLOBALS['cfg']['Server']['port'] = '80'; $GLOBAL...
Class
2
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
Class
2
public function AbbreviateHash($project, $hash) { if (!$project) return $hash; if (!(preg_match('/[0-9A-Fa-f]{40}/', $hash))) { return $hash; } $args = array(); $args[] = '-1'; $args[] = '--format=format:%h'; $args[] = $hash; $abbrevData = explode("\n", $this->exe->Execute($project->GetPath()...
Base
1
public function addRemote($name, $url, array $params = NULL) { $this->run('remote', 'add', $params, $name, $url); return $this; }
Class
2
private function userCanSeeUserGroups($project_id) { $project = $this->project_manager->getProject($project_id); $user = $this->user_manager->getCurrentUser(); ProjectAuthorization::userCanAccessProject($user, $project, new URLVerification()); return true; }
Class
2
private function _minoredits( $option ) { if ( isset( $option ) && $option == 'exclude' ) { $this->addTable( 'revision', 'revision' ); $this->addWhere( 'revision.rev_minor_edit = 0' ); } }
Class
2
$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...
Base
1
public function fromData($data, $filename) { if ($data === null) { return; } $tempPath = temp_path(basename($filename)); FileHelper::put($tempPath, $data); $file = $this->fromFile($tempPath); FileHelper::delete($tempPath); return $file; ...
Class
2
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...
Base
1
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']))...
Base
1
public function actionView($id){ // add media object to user's recent item list User::addRecentItem('m', $id, Yii::app()->user->getId()); $this->render('view', array( 'model' => $this->loadModel($id), )); }
Class
2
function html_show_tabs_left() { global $config, $tabs_left; if (is_realm_allowed(8)) { $show_console_tab = true; } else { $show_console_tab = false; } if (get_selected_theme() == 'classic') { if ($show_console_tab == true) { ?><a <?php print (is_console_page(get_current_page()) ? " id='maintab-anchor" ...
Base
1
public function approve_toggle() { global $history; if (empty($this->params['id'])) return; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $r...
Class
2
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()...
Base
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
Base
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 { ...
Class
2
$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...
Base
1
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...
Class
2
function get_show_item ($directory, $file) { if ( preg_match( "/\.\./", $directory ) ) return false; if ( isset($file) && preg_match( "/\.\./", $file ) ) return false; // dont display own directory if ( $file == "." ) return false; if ( substr( $file, 0, 1) == "." && $GLOB...
Base
1
$ins = array( 'table' => 'options', 'key' => array( 'name' => $name, 'value' => $value ) ); $opt = Db::insert($ins); ...
Base
1
$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...
Base
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); }
Base
1
$criteria->addCondition ( 'user IN (' . 'SELECT DISTINCT b.username ' . 'FROM x2_group_to_user a JOIN x2_group_to_user b ' . 'ON a.groupId=b.groupId ' . 'WHERE a.username=:getAccessCriteri...
Base
1
public function fixsessions() { global $db; // $test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket'); $fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket'); flash('message', gt('Sessions Table was Repaired')); expHistory::back(); }
Base
1
protected function getTestServiceSubscriberService() { return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber(); }
Base
1
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->par...
Base
1
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
private function setDefaults() { $this->setParameter( 'defaulttemplatesuffix', '.default' ); $parameters = $this->getParametersForRichness(); foreach ( $parameters as $parameter ) { if ( $this->getData( $parameter )['default'] !== null && !( $this->getData( $parameter )['default'] === false && $this->getData...
Class
2
public function fixsessions() { global $db; // $test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket'); $fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket'); flash('message', gt('Sessions Table was Repaired')); expHistory::back(); }
Base
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 ...
Base
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...
Base
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; }
Base
1
public static function isExist($user) { if (isset($_GET['act']) && $_GET['act'] == 'edit') { $id = Typo::int($_GET['id']); $where = "AND `id` != '{$id}' "; } else { $where = ''; } $user = sprintf('%s', Typo::cleanX($user)); $sql = sprin...
Base
1
public function __construct(string $user = null, string $field = 'id') { $this->_db = DB::getInstance(); $this->_sessionName = Config::get('session.session_name'); $this->_cookieName = Config::get('remember.cookie_name'); $this->_admSessionName = Config::get('session.admin_name'); ...
Base
1
private function _namespace( $option ) { $option === 0 ?? $option = '0'; if ( is_array( $option ) && count( $option ) ) { if ( $this->parameters->getParameter( 'openreferences' ) ) { $this->addWhere( [ "{$this->tableNames['pagelinks']}.pl_namespace" => $option ] ); } else { $this-...
Class
2
public static function email($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]->email; }
Base
1
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
Base
1
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType, $connection; switch ($DatabaseType) { case 'mysqli': $connection = new ConnectDBOpensis(); if ($connection->auto_init == true) { $connection = $connection->init($DatabaseServe...
Base
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
Base
1
public function renew2FaSecretAction(Request $request) { $this->checkCsrfToken($request); $user = $this->getAdminUser(); $proxyUser = $this->getAdminUser(true); $twoFactorService = $this->get('scheb_two_factor.security.google_authenticator'); $newSecret = $twoFactorServ...
Base
1
function HackingLog() { echo "" . _youReNotAllowedToUseThisProgram . "! " . _thisAttemptedViolationHasBeenLoggedAndYourIpAddressWasCaptured . "."; Warehouse('footer'); if ($_SERVER['HTTP_X_FORWARDED_FOR']) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip = $_SERVER['REMOTE_ADDR']; } if ($openSISNotify...
Base
1
public function getCompiledPath($path) { return $this->cachePath.'/'.sha1($path).'.php'; }
Class
2
function __construct() { # code... self::$smtphost = Options::get('smtphost'); self::$smtpuser = Options::get('smtpuser'); self::$smtppass = Options::get('smtppass'); self::$smtpssl = Options::get('smtpssl'); self::$siteemail = Options::get('siteema...
Base
1
public function save_change_password() { global $user; $isuser = ($this->params['uid'] == $user->id) ? 1 : 0; if (!$user->isAdmin() && !$isuser) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } ...
Base
1
public function rename() { if (!AuthUser::hasPermission('file_manager_rename')) { Flash::set('error', __('You do not have sufficient permissions to rename this file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks i...
Class
2
$body = str_replace(array("\n"), "<br />", $body); } else { // It's going elsewhere (doesn't like quoted-printable) $body = str_replace(array("\n"), " -- ", $body); } $title = $items[...
Class
2
hb_map_clear (hb_map_t *map) { if (unlikely (hb_object_is_immutable (map))) return; return map->clear (); }
Base
1
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
Base
1
protected static function __Load($path) { include_once($path); }
Compound
4
public function tableCleanup(int $maxInactiveMinutes = 30) { $now = new \DateTime(); $minutesBack = new \DateInterval('PT' . $maxInactiveMinutes . 'M'); $timestamp = $now->sub($minutesBack)->format('Y-m-d H:i:s'); $sql = 'DELETE FROM '.TBL_SESSIONS.' WHERE ses_t...
Base
1
function update_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; //This will make sure that only the country or region that given a rate value will be saved in the db $upcharge = array(); foreach($this->params['upch...
Base
1
$date->delete(); // event automatically deleted if all assoc eventdates are deleted } expHistory::back(); }
Base
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); }
Base
1
static function FromJSON($sJson) { if (is_array($sJson)) { $aJson = $sJson; } else { $aJson = json_decode($sJson, true); } /** @var \Combodo\iTop\Portal\Form\ObjectFormManager $oFormManager */ $oFormManager = parent::FromJSON($sJson); // Retrieving object to edit if (!isset($aJson['formobj...
Base
1
function nvweb_dictionary_load() { global $DB; global $session; global $website; global $theme; $dictionary = array(); // the dictionary is an array merged from the following sources (- to + preference) // theme dictionary (json) // theme dictionary on database // webdictionary custom entries ...
Base
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...
Base
1
public function testCanSetHeaderAsArray() { $r = new Response(200, [ 'foo' => ['baz ', ' bar '] ]); $this->assertEquals('baz, bar', $r->getHeaderLine('foo')); $this->assertEquals(['baz', 'bar'], $r->getHeader('foo')); }
Base
1
public function edit(Request $request, $id) { return $this->view('page::admin.page.edit', [ 'content_id'=>$id ]); }
Base
1
public static function remove($id) { global $DB; global $website; if(empty($id)) return 'invalid_id'; $DB->execute(' DELETE FROM nv_notes WHERE website = '.protect($website->id).' AND id = '.protect($id).' ...
Base
1
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...
Base
1
public function fetch($remote = NULL, array $params = NULL) { $this->run('fetch', $remote, $params); return $this; }
Class
2
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; }
Base
1
public function lists($column, $key = null) { $select = is_null($key) ? [$column] : [$column, $key]; if (!is_null($this->cacheMinutes)) { $results = $this->getCached($select); } else { $results = $this->getFresh($select); } $collection = ...
Base
1
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
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...
Base
1
public static function canImportData() { return true; }
Base
1
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']))...
Base
1
$tableDetails = ['tableName' => $tableName, 'entityIdColumn' => $entityIdColumn];
Class
2
static function canView() { return Session::haveRight(self::$rightname, READ); }
Compound
4