code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
public function manage() { expHistory::set('viewable', $this->params); $page = new expPaginator(array( 'model'=>'order_status', 'where'=>1, 'limit'=>10, 'order'=>'rank', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'control...
Class
2
public function event() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id'])) { return $this->create(); } return $this->response->html($this->template->render('action_creat...
Base
1
protected function checkMaintenanceMode() { if (Yii::$app->settings->get('maintenanceMode')) { if (!Yii::$app->user->isGuest) { Yii::$app->user->logout(); Yii::$app->getView()->warn(Yii::t('error', 'Maintenance mode activated: You have been automatically logge...
Class
2
self::removeLevel($kid->id); } }
Base
1
public function confirm(string $token) { try { $userId = $this->emailConfirmationService->checkTokenAndGetUserId($token); } catch (UserTokenNotFoundException $exception) { $this->showErrorNotification(trans('errors.email_confirmation_invalid')); return redire...
Compound
4
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...
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($ro...
Base
1
private function edebug($str) { if ($this->Debugoutput == "error_log") { error_log($str); } else { echo $str; } }
Base
1
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
public function testCookiePathWithEmptySetCookiePath($uriPath, $cookiePath) { $response = (new Response(200)) ->withAddedHeader( 'Set-Cookie', "foo=bar; expires={$this->futureExpirationDate()}; domain=www.example.com; path=;" ) ->withAd...
Class
2
foreach ($value as $valueKey => $valueValue) { if (\is_int($valueKey)) { $filteredKey = $valueKey; } else { $filteredKey = self::filterValue($valueKey, $regex, $stripTags); } if ($filteredKey === '' || $filteredKey === null) { ...
Base
1
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
Class
2
public function approve_submit() { global $history; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); $lastUrl = expHistory::getLast('editable'); } /* The global constants can be overriden by passi...
Base
1
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...
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 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
public function delete(AvailableBudget $availableBudget) { $this->abRepository->destroyAvailableBudget($availableBudget); session()->flash('success', trans('firefly.deleted_ab')); return redirect(route('budgets.index')); }
Compound
4
function edit_optiongroup_master() { expHistory::set('editable', $this->params); $id = isset($this->params['id']) ? $this->params['id'] : null; $record = new optiongroup_master($id); assign_to_template(array( 'record'=>$record )); }
Base
1
public function getSiteInfo() { // check for a site request param if(empty($this->getSite())){ $this->setName(get_bloginfo('name')); $this->setDescription(get_bloginfo('description')); $this->setRestApiUrl(get_rest_url()); $this->setSite(get_blogin...
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
protected function renderImageByGD($code) { $image = imagecreatetruecolor($this->width, $this->height); $backColor = imagecolorallocate( $image, (int) ($this->backColor % 0x1000000 / 0x10000), (int) ($this->backColor % 0x10000 / 0x100), $this->bac...
Class
2
public function getTrackingId() { if(isset($this->ectid)) return $this->ectid; else return ''; }
Base
1
public function autocomplete() { return; global $db; $model = $this->params['model']; $mod = new $model(); $srchcol = explode(",",$this->params['searchoncol']); /*for ($i=0; $i<count($srchcol); $i++) { if ($i>=1) $sql .= " OR "; $sql .= $srchc...
Class
2
function delete_option_master() { global $db; $masteroption = new option_master($this->params['id']); // delete any implementations of this option master $db->delete('option', 'option_master_id='.$masteroption->id); $masteroption->delete('optiongroup_master_id=' . $...
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
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
Base
1
public static function insert ($vars) { if(is_array($vars)){ $set = ""; $k = ""; foreach ($vars['key'] as $key => $val) { $set .= "'$val',"; $k .= "`$key`,"; } $set = substr($set, 0,-1); $k =...
Base
1
protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage) { parent::markCompleted($endStatus, $serviceResponse, $gatewayMessage); $this->createMessage(Message\VoidedResponse::class, $gatewayMessage); ErrorHandling::safeExtend($this->payment, 'onVoid...
Class
2
public static function hasChildren($i) { global $sections; if (($i + 1) >= count($sections)) return false; return ($sections[$i]->depth < $sections[$i + 1]->depth) ? true : false; }
Base
1
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_products WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command...
Class
2
$ret = array_merge($ret, csrf_flattenpost2(1, $n, $v)); }
Compound
4
public function testAddsDefaultReason() { $r = new Response('200'); $this->assertSame(200, $r->getStatusCode()); $this->assertEquals('OK', $r->getReasonPhrase()); }
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...
Class
2
function generate_key($size) { if ( is_callable('openssl_random_pseudo_bytes') and !(version_compare(PHP_VERSION, '5.3.4') < 0 and defined('PHP_WINDOWS_VERSION_MAJOR')) ) { return substr( str_replace( array('+', '/'), '', base64_encode(openssl_random_pseudo_bytes($size+...
Base
1
public static function hasChildren($i) { global $sections; if (($i + 1) >= count($sections)) return false; return ($sections[$i]->depth < $sections[$i + 1]->depth) ? true : false; }
Class
2
public static function admin () { }
Base
1
public function active($id, $active) { $this->auth->checkIfOperationIsAllowed('list_users'); $this->users_model->setActive($id, $active); $this->session->set_flashdata('msg', lang('users_edit_flash_msg_success')); redirect('users'); }
Compound
4
private function _notuses( $option ) { if ( count( $option ) > 0 ) { $where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['templatelinks'] . '.tl_from FROM ' . $this->tableNames['templatelinks'] . ' WHERE ('; $ors = []; foreach ( $option as $linkGroup ) { foreach ( $linkGr...
Class
2
$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...
Class
2
public function clearTags() { $this->_tags = array(); // clear tag cache return (bool) CActiveRecord::model('Tags')->deleteAllByAttributes(array( 'type' => get_class($this->getOwner()), 'itemId' => $this->getOwner()->id) ); }
Base
1
public function toolbar() { // global $user; $menu = array(); $dirs = array( BASE.'framework/modules/administration/menus', BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus' ); foreach ($dirs as $dir) { if (is_readable($dir)) { $dh = opendir($dir); while (...
Base
1
public function manage() { expHistory::set('viewable', $this->params); $page = new expPaginator(array( 'model'=>'order_status', 'where'=>1, 'limit'=>10, 'order'=>'rank', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'control...
Base
1
public function __construct () { }
Base
1
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
Base
1
public function __construct(UserInviteService $inviteService, LoginService $loginService, UserRepo $userRepo) { $this->middleware('guest'); $this->middleware('guard:standard'); $this->inviteService = $inviteService; $this->loginService = $loginService; $this->userRepo = ...
Compound
4
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 = []; ...
Base
1
function fopen($filename, $mode) { if (\yiiunit\framework\base\SecurityTest::$fopen !== null) { return \yiiunit\framework\base\SecurityTest::$fopen; } return \fopen($filename, $mode); }
Class
2
protected function defaultExtensions() { return [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'svg', 'js', 'map', 'ico', 'css', 'less', 'scss', ...
Base
1
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
Base
1
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->...
Class
2
public function post_prop () { $file = urldecode (join ('/', func_get_args ())); if (! FileManager::verify_file ($file)) { return $this->error (__ ('Invalid file name')); } // handle multiple properties at once if (isset ($_POST['props'])) { if (! is_array ($_POST['props'])) { return $this->erro...
Base
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 = ...
Class
2
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
Class
2
protected function registerBackendPermissions() { BackendAuth::registerCallback(function ($manager) { $manager->registerPermissions('October.Backend', [ 'backend.access_dashboard' => [ 'label' => 'system::lang.permissions.view_the_dashboard', ...
Base
1
function searchCategory() { return gt('Event'); }
Base
1
function searchCategory() { return gt('Event'); }
Class
2
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); return $this->connect->rename($source, $target) ? $target : false; }
Base
1
foreach ($flatArray as $key => $value) { $pattern = '/' . $key . '([^.]|$)/'; if (preg_match($pattern, $expression, $matches)) { switch (gettype($flatArray[$key])) { case 'boolean': $expression = str_replace($key, $flatArray[$k...
Class
2
$v = trim($v); if ($v !== '') { $_POST[$key][] = $v; } } }
Class
2
$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")...
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
public function getDisplayName ($plural=true) { return Yii::t('contacts', '{contact} List|{contact} Lists', array( (int) $plural, '{contact}' => Modules::displayName(false, 'Contacts'), )); }
Base
1
protected function moveVotes() { $sql = "SELECT * FROM package_proposal_votes WHERE pkg_prop_id = {$this->proposal}"; $res = $this->mdb2->query($sql); if (MDB2::isError($res)) { throw new RuntimeException("DB error occurred: {$res->getDebugInfo()}"); } if ($re...
Base
1
public static function filterValue($value, $regex, $stripTags = true) { if (empty($value)) { return $value; } if ($stripTags) { $value = strip_tags($value); } if (preg_match($regex, $value)) { return null; } return $v...
Base
1
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
Base
1
public function getImage($id){ $url = "http://api.themoviedb.org/3/movie/{$id}/images?api_key=".$this->apikey; $cast = $this->curl($url); return $cast; }
Base
1
protected function _fclose($fp, $path='') { @fclose($fp); if ($path) { @unlink($this->getTempFile($path)); } }
Base
1
$file = explode('.', $lang); if ($var == $file[0]) { $sel = 'SELECTED'; }else{ $sel = ''; } $opt .= "<option {$sel}>{$file[0]}</option>"; } return $opt; }
Base
1
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...
Class
2
function get(&$dbh, $proposalId, $handle) { $sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS timestamp FROM package_proposal_votes WHERE pkg_prop_id = ". $dbh->quoteSmart($proposalId) ." AND user_handle= ". $dbh->quoteSmart($handle); $res = $dbh->query($sql); if (DB::isError($res)) { ...
Base
1
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...
Base
1
public function testFullRun() { $command = $this->getCommand(); $commandTester = new CommandTester($command); $commandTester->setInputs(['no']); $commandTester->execute([ 'command' => $command->getName(), ]); $result = $commandTester->getDisplay(); ...
Base
1
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
Class
2
public static function canView($section) { global $db; if ($section == null) { return false; } if ($section->public == 0) { // Not a public section. Check permissions. return expPermissions::check('view', expCore::makeLocation('navigation...
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 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 ...
Base
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...
Base
1
function manage() { global $db, $router, $user; expHistory::set('manageable', $router->params); assign_to_template(array( 'canManageStandalones' => self::canManageStandalones(), 'sasections' => $db->selectObjects('section', 'parent=-1'), ...
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 productFeed() { // global $db; //check query password to avoid DDOS /* * condition = new * description * id - SKU * link * price * title * brand - manufacturer ...
Base
1
public static function insert($vars){ if(is_array($vars)){ $sql = array( 'table' => 'menus', 'key' => $vars ); $menu = Db::insert($sql); } }
Base
1
private function load($id) { global $zdb; try { $select = $zdb->select(self::TABLE); $select->limit(1)->where(self::PK . ' = ' . $id); $results = $zdb->execute($select); $res = $results->current(); $this->id = $id; $this->...
Base
1
public function approvedFileExtension($filename, $type = 'image') { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if ($type == 'image') { switch ($ext) { case 'gif': case 'png': case 'jpeg': case 'jpg': case 'svg': return true; default: return false; } } els...
Base
1
public static function getIconName($module) { return isset(static::$iconNames[$module]) ? static::$iconNames[$module] : strtolower(str_replace('_', '-', $module)); }
Class
2
public static function dropdown($vars) { return Categories::dropdown($vars); }
Base
1
public function testSetSaveHandler53() { if (PHP_VERSION_ID >= 50400) { $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } $this->iniSet('session.save_handler', 'files'); $storage = $this->getStorage(); $storage->setSaveHandler(); $this->ass...
Base
1
function prepareInputForAdd($input) { //If it's the first ldap directory then set it as the default directory if (!self::getNumberOfServers()) { $input['is_default'] = 1; } if (isset($input["rootdn_passwd"]) && !empty($input["rootdn_passwd"])) { $input["rootdn_passwd"] = T...
Base
1
function getRights($interface = 'central') { $values = [READ => __('Read'), CREATE => __('Create'), PURGE => _x('button', 'Delete permanently'), self::CHECKUPDATE => __('Check for upgrade')]; re...
Compound
4
private function formatMessage($message) { if ($this->timezone) { $graylogTime = new DateTime($message['message']['timestamp']); $offset = $this->timezone->getOffset($graylogTime); $timeInterval = DateInterval::createFromDateString((string) $offset . 'seconds'); ...
Base
1
function httpsTestController($serverPort) { $args = array('HTTPS' => ''); var_dump(request(php_uname('n'), $serverPort, "test_https.php", [], [], $args)); }
Class
2
return ${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] = new \S...
Base
1
public function Connected() { if(!empty($this->smtp_conn)) { $sock_status = socket_get_status($this->smtp_conn); if($sock_status["eof"]) { // the socket is valid but we are not connected if($this->do_debug >= 1) { $this->edebug("SMTP -> NOTICE:" . $this->CRLF . "EOF caught ...
Class
2
$curVal[$key] = $tp->post_toForm($val); } } $target = e107::getUrl()->create('user/myprofile/edit',array('id'=>USERID)); $text = '<form method="post" action="'.$target.'" id="dataform" class="usersettings-form form-horizontal" enctype="multipart/form-data" autocomplete="off">'; //$text = (is_numeric(...
Class
2
public static function autoload() { include (GX_LIB."Vendor/autoload.php"); }
Base
1
public function manage() { expHistory::set('manageable',$this->params); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( ...
Class
2
function selectBillingOptions() { }
Class
2
function function_exists($name) { if (isset(\yiiunit\framework\base\SecurityTest::$functions[$name])) { return \yiiunit\framework\base\SecurityTest::$functions[$name]; } return \function_exists($name); }
Class
2
public static function attach($hooks_name, $func) { $hooks = self::$hooks; $hooks[$hooks_name][] = $func; self::$hooks = $hooks; return self::$hooks; }
Base
1
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
Base
1
public function validateByMode(App\Request $request) { if ($request->isEmpty('purifyMode') || !$request->has('value')) { throw new \App\Exceptions\NoPermitted('ERR_ILLEGAL_VALUE', 406); } $response = new Vtiger_Response(); $response->setResult([ 'raw' => $request->getByType('value', $request->getByType(...
Base
1