code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
function verifyCSRFToken() { $clean_referer = str_replace(array("http://","https://"),"//",$_SERVER["HTTP_REFERER"]); $clean_domain = str_replace(array("http://","https://"),"//",DOMAIN); $token = isset($_POST[$this->CSRFTokenField]) ? $_POST[$this->CSRFTokenField] : $_GET[$this->CSRFTokenField]; if (...
Compound
4
public function setPageTextMatchNotRegex( array $pageTextMatchNotRegex = [] ) { $this->pageTextMatchNotRegex = (array)$pageTextMatchNotRegex; }
Class
2
$percent = round($percent, 0); } else { $percent = round($percent, 2); // school default } if ($ret == '%') return $percent; if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id]) $_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TI...
Base
1
private function resize_gd($src, $width, $height, $quality, $srcImgInfo) { switch ($srcImgInfo['mime']) { case 'image/gif': if (@imagetypes() & IMG_GIF) { $oSrcImg = @imagecreatefromgif($src); } else { $ermsg = 'GIF images are not supported'; } break; case 'image/jpeg': if (@image...
Base
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...
Base
1
public static function error ($vars="") { if( isset($vars) && $vars != "" ) { include(GX_PATH.'/inc/lib/Control/Error/'.$vars.'.control.php'); }else{ include(GX_PATH.'/inc/lib/Control/Error/404.control.php'); } }
Compound
4
public function browse() { $params = func_get_args(); $this->path = join('/', $params); // make sure there's a / at the end if (substr($this->path, -1, 1) != '/') $this->path .= '/'; //security // we dont allow back link if (strpos($this->path, '...
Class
2
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...
Base
1
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ;
Base
1
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
Base
1
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...
Base
1
function PMA_getCentralColumnsCount($db) { $cfgCentralColumns = PMA_centralColumnsGetParams(); if (empty($cfgCentralColumns)) { return 0; } $pmadb = $cfgCentralColumns['db']; $GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']); $central_list_table = $cfgCentralColumns['table']; ...
Base
1
public function prepare( $query, $args ) { if ( is_null( $query ) ) return; // This is not meant to be foolproof -- but it will catch obviously incorrect usage. if ( strpos( $query, '%' ) === false ) { _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'w...
Base
1
public static function modList() { //$mod = ''; $handle = dir(GX_MOD); while (false !== ($entry = $handle->read())) { if ($entry != '.' && $entry != '..') { $dir = GX_MOD.$entry; if (is_dir($dir) == true) { (file_exists($dir...
Base
1
protected function cacheDir($path) { $this->dirsCache[$path] = array(); $sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs FROM '.$this->tbf.' AS f LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.id AN...
Base
1
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...
Base
1
public static function mod($var) { self::load($var); }
Base
1
public static function validator($vars =""){ $GLOBALS['validator'] = true; $GLOBALS['validator_js'] = $vars; //return $editor; }
Base
1
$iloc = expUnserialize($container->internal); if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) { // There is no sectionref for this container. Populate sectionref if ($container->external != "N;") { $newSecRef = new stdClass...
Class
2
public static function update($vars) { if(is_array($vars)) { //$slug = Typo::slugify($vars['title']); //$vars = array_merge($vars, array('slug' => $slug)); //print_r($vars); $id = Typo::int($_GET['id']); $ins = array( ...
Base
1
public function saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->...
Class
2
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...
Base
1
public function getQuerySelect() { $R2 = 'R2_' . $this->id; return "$R2.value AS `" . $this->name . "`"; }
Base
1
public static function destroy () { session_destroy(); unset($_SESSION['gxsess']); }
Base
1
public static function object_votes_by_webuser($object, $object_id, $orderby='date desc', $offset=0, $limit=PHP_INT_MAX) { global $DB; global $website; $DB->queryLimit('wuv.id AS id, wuv.date AS date, wuv.webuser AS webuser, wu.username AS username', 'nv_webuser_votes wuv, nv_webusers wu', ...
Base
1
public function LoadContainingTag($commit) { if (!$commit) return; $args = array(); $args[] = '--tags'; $args[] = $commit->GetHash(); $revs = explode("\n", $this->exe->Execute($commit->GetProject()->GetPath(), GIT_NAME_REV, $args)); foreach ($revs as $revline) { if (preg_match('/^([0-9a-fA-F]{40})...
Base
1
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()) { ...
Base
1
function draw_vdef_preview($vdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>vdef=<?php print get_vdef($vdef_id, true);?></pre> </td> </tr> <?php }
Base
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()...
Base
1
function draw_cdef_preview($cdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>cdef=<?php print get_cdef($cdef_id, true);?></pre> </td> </tr> <?php }
Base
1
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
$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...
Base
1
public function verifyDOMDocument($document) { $signatureNode = $this->locateSignature($document); /** * No signature was added, it should not fail as this is not a requirement on redirect bindings */ if (!$signatureNode) { return true; } $...
Base
1
$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
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...
Class
2
function searchName() { return gt('Webpage'); }
Base
1
public function getFilePath($fileName = null) { if ($fileName === null) { $fileName = $this->fileName; } return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName; }
Variant
0
public function backup($type='json') { global $DB; global $website; $DB->query('SELECT * FROM nv_coupons WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; ...
Base
1
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...
Base
1
public function testNewInstanceWhenAddingHeaderThatWasNotThereBefore() { $r = new Response(200, ['Foo' => 'Bar']); $r2 = $r->withAddedHeader('Baz', 'Bam'); $this->assertNotSame($r, $r2); $this->assertEquals('Bam', $r2->getHeaderLine('Baz')); $this->assertEquals('Bar', $r2...
Base
1
function headerTestController($serverPort) { $args = array('Authorization' => 'foo'); var_dump(request(php_uname('n'), $serverPort, "test_headers.php", [], ['PROXY' => 'foobar'], $args)); }
Class
2
public static function flagLib () { return "<link href=\"".Site::$url."/assets/css/flag-icon.min.css\" rel=\"stylesheet\">"; }
Base
1
function _getHtmlHeaderColumn($title, $name, $pageName, $entityIds, $listorder, $orderdirection, $showColumn = true) { $str = ''; $entity = _getEntityString($entityIds); if ($listorder == $name) { if (($orderdirection == '') || ($orderdirection == 'down')) { $str = "<a href='$pageName?{$...
Base
1
$module_views[$key]['name'] = gt($value['name']); } // look for a config form for this module's current view // $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod); //check to see if hcview was passed along, indicating a hard-coded module // if (!empty($contr...
Base
1
$section = new section(intval($page)); if ($section) { // self::deleteLevel($section->id); $section->delete(); } } }
Base
1
public function isMethodSafe() { return in_array($this->getMethod(), array('GET', 'HEAD')); }
Base
1
function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) { if (empty($endtimestamp)) { $date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($timestamp) . ")"; } else {...
Class
2
public function confirm() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask/remove', array( 'subtask' => $subtask, 'task' => $task, ))); }
Base
1
protected function _copy($source, $targetDir, $name) { $this->clearcache(); $id = $this->_joinPath($targetDir, $name); $sql = $id > 0 ? sprintf('REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden`) (SELECT %d, %d, name, content, size, mtime, mi...
Base
1
public function testPostRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId) { $request = new Enlight_Controller_Request_RequestTestCase(); $request->setMethod('POST'); $response = new Enlight_Controller_Response_ResponseTestCase(); $request->setPat...
Base
1
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...
Class
2
public function save(){ $login_user = $this->checkLogin(); $uid = $login_user['uid'] ; $id = I("id/d"); $member_group_id = I("member_group_id/d"); $cat_id = I("cat_id/d"); $teamItemMemberInfo = D("TeamItemMember")->where(" id = '$id' ")->find(); $item_id = ...
Compound
4
protected function createSubRequest($uri, Request $request) { $cookies = $request->cookies->all(); $server = $request->server->all(); // Override the arguments to emulate a sub-request. // Sub-request object will point to localhost as client ip and real client ip // will...
Class
2
public static function navtojson() { return json_encode(self::navhierarchy()); }
Base
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 { ...
Base
1
public static function desc($vars){ if(!empty($vars)){ $desc = substr(strip_tags(htmlspecialchars_decode($vars).". ".Options::get('sitedesc')),0,150); }else{ $desc = substr(Options::get('sitedesc'),0,150); } return $desc; }
Base
1
function token($str) { $fw=$this->fw; $str=trim(preg_replace('/\{\{(.+?)\}\}/s',trim('\1'), $fw->compile($str))); if (preg_match('/^(.+)(?<!\|)\|((?:\h*\w+(?:\h*[,;]?))+)$/s', $str,$parts)) { $str=trim($parts[1]); foreach ($fw->split(trim($parts[2],"\xC2\xA0")) as $func) $str=((empty($this->filte...
Class
2
function delete_selected() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item && $item->is_recurring == 1) { $event_remaining = false; $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id); foreach ($eventdates as ...
Class
2
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
$dt = date('Y-m-d', strtotime($match)); $sql = par_rep("/'$match'/", "'$dt'", $sql); } } if (substr($sql, 0, 6) == "BEGIN;") { $array = explode(";", $sql); foreach ($array as $value) { if ($value != "") { $result = $connection->query($value); if (!$result) { $connecti...
Base
1
public function load_from_post() { $this->title = $_REQUEST['title']; $this->file = $_REQUEST['file']; $this->permission = intval($_REQUEST['permission']); $this->enabled = intval($_REQUEST['enabled']); // sections $this->sections = array(); for($s = 0; $s < count($_REQUEST['template...
Base
1
public static function delParam($param, $post_id) { $sql = "DELETE FROM `posts_param` WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' LIMIT 1"; $q = Db::query($sql); if ($q) { return true; }else{ return false; } }
Base
1
public function delete_version() { if (empty($this->params['id'])) { flash('error', gt('The version you are trying to delete could not be found')); } // get the version $version = new help_version($this->params['id']); if (empty($version->id)) { flash('error', gt('The v...
Class
2
private function addInlineReference($id, Definition $definition, $targetId, $forConstructor) { list($callCount, $behavior) = $this->serviceCalls[$targetId]; while ($this->container->hasAlias($targetId)) { $targetId = (string) $this->container->getAlias($targetId); } ...
Base
1
function NewSectionPrompt(){ global $langmessage; ob_start(); echo '<div class="inline_box">'; echo '<form method="post" action="'.common::GetUrl($this->title).'">'; echo '<h2>'.$langmessage['new_section_about'].'</h2>'; echo '<table class="bordered full_width">'; echo '<tr><th colspan="2">'.$langmess...
Base
1
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'"); } if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records); // eDebug($sql, true); // count the ...
Base
1
protected function curl_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); if ($outfp) { curl_setopt($ch, CURLOPT_FILE, $outfp); } else { curl...
Base
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; ...
Base
1
public function Reset() { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Reset() without being connected"); return false; } fputs($this->smtp_conn,"RSET" . $this->CRLF); $rply = $this->get_lines(); ...
Class
2
function get_filedisplay_views() { expTemplate::get_filedisplay_views(); $paths = array( BASE.'framework/modules/common/views/file/', BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/', ); $views = array(); foreach ($paths as $path) { if (is_readable($path)) { ...
Base
1
public static function publish($id) { $id = Typo::int($id); $ins = array( 'table' => 'posts', 'id' => $id, 'key' => array( 'status' => '1' ) ); $po...
Base
1
foreach ($day as $extevent) { $event_cache = new stdClass(); $event_cache->feed = $extgcalurl; $event_cache->event_id = $extevent->event_id; $event_cache->title = $extevent->title; ...
Base
1
public function duplicateTeam(Team $team, Request $request) { $newTeam = clone $team; $newTeam->setName($team->getName() . ' [COPY]'); try { $this->repository->saveTeam($newTeam); $this->flashSuccess('action.update.success'); return $this->redirectTo...
Compound
4
public function doConfigPageInit($page) { $action = isset($_REQUEST['action'])?$_REQUEST['action']:''; //the extension we are currently displaying $managerdisplay = isset($_REQUEST['managerdisplay'])?$_REQUEST['managerdisplay']:''; $name = isset($_REQUEST['name'])?$_REQUEST['name']:''; $secret = isset($_REQU...
Base
1
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestService...
Base
1
function connect() { return $this->connectToServer($this->fields['host'], $this->fields['port'], $this->fields['rootdn'], Toolbox::decrypt($this->fields['rootdn_passwd'], GLPIKEY), $this->fields['use_tl...
Base
1
public function onInfoAction( $context, &$pageInfo ) { $shortdesc = HookUtils::getShortDescription( $context->getTitle() ); if ( !$shortdesc ) { // The page has no short description return; } $pageInfo['header-basic'][] = [ $context->msg( 'shortdescription-info-label' ), $shortdesc ]; }
Base
1
public function testGetFilteredEventsDataProvider () { TestingAuxLib::loadX2NonWebUser (); TestingAuxLib::suLogin ('testuser'); Yii::app()->settings->historyPrivacy = null; $profile = Profile::model()->findByAttributes(array('username' => 'testuser')); $retVal = Events::getFi...
Base
1
protected function tearDown() { static::$functions = []; static::$fopen = null; static::$fread = null; parent::tearDown(); }
Class
2
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()
Base
1
public function update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { ...
Base
1
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($row['TYPE'], strpos($row['TYPE'], '(')); ...
Base
1
function reset_stats() { // global $db; // reset the counters // $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1'); banner::resetImpressions(); // $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1'); banner::resetClicks(); /...
Base
1
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
Base
1
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Base
1
function phoromatic_error_page($title, $description) { echo phoromatic_webui_header(array(''), ''); $box = '<h1>' . $title . '</h1> <h2>' . $description . '</h2> <p>To fix this error, try <a onclick="javascript:window.history.back();">returning to the previous page</a>. Still having problems? Consider <a href="h...
Base
1
$tableBody[] = array($row['label'], $row['nb_visits'], $row['bounce_rate']); if ($count == 10) break; } $this->table($tableHead, $tableBody, null); } }
Base
1
public function beforeFilter() { // TODO REMOVE parent::beforeFilter(); $this->Security->unlockedActions = array('saveElementSorting', 'populateEventFromTemplate', 'uploadFile', 'deleteTemporaryFile'); }
Base
1
function twig_array_reduce(Environment $env, $array, $arrow, $initial = null) { if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { throw new RuntimeError('The callable passed to the "reduce" fil...
Class
2
* function my_query_args_filter( $field_query ) { * // your code here * return $field_query; * }
Base
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 { ...
Base
1
public function saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->...
Base
1
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestSe...
Base
1
public function getIterator() { @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED); return new \ArrayIterator($this->all()); }
Base
1
public function getUpcoming(){ $url = "http://api.themoviedb.org/3/movie/upcoming?api_key=".$this->apikey; $upcoming = $this->curl($url); return $upcoming; }
Base
1
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
Base
1
function csrf_get_tokens() { $has_cookies = !empty($_COOKIE); // $ip implements a composite key, which is sent if the user hasn't sent // any cookies. It may or may not be used, depending on whether or not // the cookies "stick" $secret = csrf_get_secret(); if (!$has_cookies && $secret) { ...
Compound
4
static function description() { return gt("Places navigation links/menus on the page."); }
Base
1
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
Base
1
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...
Base
1