code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
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
function download($disposition=false, $expires=false) { $disposition = $disposition ?: 'inline'; $bk = $this->open(); if ($bk->sendRedirectUrl($disposition)) return; $ttl = ($expires) ? $expires - Misc::gmtime() : false; $this->makeCacheable($ttl); $type =...
Base
1
function init_args(&$dbHandler) { $argsObj = new stdClass(); $argsObj->doIt = false; $argsObj->showPlatforms = false; $argsObj->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $argsObj->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] ...
Base
1
function comment_item($params) { if (!user_can_access('module.comments.index')) { return; } $data = array( 'id' => $params['comment_id'], 'single' => true, ); $comment = get_comments($data); if (!$comment) { retu...
Base
1
public static function dropdown($vars) { if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE "; if(isset($vars['parent'])) { $where .= " `parent` = '{$vars['parent']}' "; }else{ $where .= "1...
Base
1
public static function is_exist($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 = sp...
Base
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...
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
private function getResponse ($size = 128) { $pop3_response = fgets($this->pop_conn, $size); return $pop3_response; }
Class
2
protected function getCustomDefinitionService() { return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition(); }
Base
1
$date->delete(); // event automatically deleted if all assoc eventdates are deleted } expHistory::back(); }
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...
Base
1
public function Connect ($host, $port = false, $tval = 30) { // Are we already connected? if ($this->connected) { return true; } /* On Windows this will raise a PHP Warning error if the hostname doesn't exist. Rather than supress it with @fsockopen, let's capture it cleanly instead ...
Class
2
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
Base
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 = $...
Base
1
public static function countries($lang="", $alpha3=false) { global $DB; global $user; // static function can be called from navigate or from a webget (user then is not a navigate user) if(empty($lang)) $lang = $user->language; $code = 'country_code'; if($alpha3) ...
Base
1
public static function CanTrustFormLayoutContent($sPostedFormManagerData, $aOriginalFormProperties) { $aPostedFormManagerData = json_decode($sPostedFormManagerData, true); $sPostedFormLayoutType = (isset($aPostedFormManagerData['formproperties']['layout']['type'])) ? $aPostedFormManagerData['formproperties']['lay...
Base
1
private function _handleCallback(){ try { // Try to get an access token using the authorization code grant. $accessToken = $this->_provider->getAccessToken('authorization_code', [ 'code' => $_GET['code'] ]); } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) { // Fail...
Compound
4
public function checkHTTP($link, $get_body = false) { if (! function_exists('curl_init')) { return null; } $handle = curl_init($link); if ($handle === false) { return null; } PMA_Util::configureCurl($handle); curl_setopt($handle, CU...
Class
2
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
Base
1
function update_optiongroup_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $og = new optiongroup_master($id); $oldtitle = $og->title; $og->update($this->params); // if the title of the master changed we should update th...
Base
1
function edit_internalalias() { $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 ...
Base
1
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
Base
1
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Class
2
static function description() { return "Manage events and schedules, and optionally publish them."; }
Base
1
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
protected function tearDown() { static::$functions = []; static::$fopen = null; static::$fread = null; parent::tearDown(); }
Class
2
public function onLoadRecord() { $scheduleCode = post('recordId'); $scheduleItem = $this->getSchedule($scheduleCode); $formTitle = sprintf(lang($this->formTitle), lang('admin::lang.text_'.$scheduleCode)); return $this->makePartial('recordeditor/form', [ 'formRecordI...
Base
1
$contents = ['form' => tep_draw_form('reviews', 'reviews.php', 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id . '&action=deleteconfirm')];
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...
Class
2
public function manage_sitemap() { global $db, $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 (...
Base
1
$args['name'][$i] = $this->sanitizeFileName($name, $opts); } } else { $args['name'] = $this->sanitizeFileName($args['name'], $opts); } } return true; }
Base
1
$ds = self::connectToServer($replicate["host"], $replicate["port"], $ldap_method['rootdn'], Toolbox::decrypt($ldap_method['rootdn_passwd'], GLPIKEY), $ldap_method['use_tls'], $ldap_method[...
Class
2
public static function TimeZone(){ $timezones = DateTimeZone::listAbbreviations(DateTimeZone::ALL); $cities = array(); foreach( $timezones as $key => $zones ) { foreach( $zones as $id => $zone ) { //print_r($zone); /**...
Base
1
function execute_backup($command) { $backup_options = get_option('dbmanager_options'); check_backup_files(); if( realpath( $backup_options['path'] ) === false ) { return sprintf( __( '%s is not a valid backup path', 'wp-dbmanager' ), stripslashes( $backup_options['path'] ) ); } else if( dbmanager_is_valid_path( ...
Class
2
public function beforeAction($action) { // Bypass when not installed for installer if (empty(Yii::$app->params['installed']) && Yii::$app->controller->module != null && Yii::$app->controller->module->id == 'installer') { return true; } ...
Class
2
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Base
1
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
Base
1
private function validateCodeInjection() { $shortMimeType = $this->getShortMimeType(0); if ($this->validateAllCodeInjection || \in_array($shortMimeType, static::$phpInjection)) { $contents = $this->getContents(); if ((1 === preg_match('/(<\?php?(.*?))/si', $contents) || false !== stripos($contents, '<?='...
Base
1
protected function _copy($source, $targetDir, $name) { $res = false; $target = $this->_joinPath($targetDir, $name); if ($this->tmp) { $local = $this->getTempFile(); if ($this->connect->get($source, $local) && $this->connect->put($target, $local, ...
Base
1
private function catchWarning ($errno, $errstr, $errfile, $errline) { $this->error[] = array( 'error' => "Connecting to the POP3 server raised a PHP warning: ", 'errno' => $errno, 'errstr' => $errstr ); }
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...
Class
2
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); break; } // Error code for ...
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
public function sendAsync(RequestInterface $request, array $options = []) { // Merge the base URI into the request URI if needed. $options = $this->prepareDefaults($options); return $this->transfer( $request->withUri($this->buildUri($request->getUri(), $options)), ...
Base
1
static function description() { return "Manage events and schedules, and optionally publish them."; }
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...
Base
1
public function showall_tags() { $images = $this->image->find('all'); $used_tags = array(); foreach ($images as $image) { foreach($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count++; } else...
Base
1
function productFeed() { // global $db; //check query password to avoid DDOS /* * condition = new * description * id - SKU * link * price * title * brand - manufacturer ...
Class
2
public function pull($remote = NULL, array $params = NULL) { $this->run('pull', $remote, $params); return $this; }
Class
2
public static function fixName($name) { $name = preg_replace('/[^A-Za-z0-9\.]/','_',$name); if ($name[0] == '.') $name[0] = '_'; return $name; // return preg_replace('/[^A-Za-z0-9\.]/', '-', $name); }
Base
1
function searchCategory() { return gt('Event'); }
Base
1
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
function getUserGroupID($name, $affilid=DEFAULT_AFFILID) { $query = "SELECT id " . "FROM usergroup " . "WHERE name = '$name' AND " . "affiliationid = $affilid"; $qh = doQuery($query, 300); if($row = mysql_fetch_row($qh)) { return $row[0]; } $query = "INSERT INTO usergroup " ...
Class
2
public function __construct() { $this->smtp_conn = 0; $this->error = null; $this->helo_rply = null; $this->do_debug = 0; }
Class
2
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.")); ...
Base
1
protected function get_remote_contents(&$url, $timeout = 30, $redirect_max = 5, $ua = 'Mozilla/5.0', $fp = null) { $method = (function_exists('curl_exec') && !ini_get('safe_mode') && !ini_get('open_basedir')) ? 'curl_get_contents' : 'fsock_get_contents'; return $this->$method($url, $timeout, $re...
Class
2
public static function theme($var, $data='') { if (isset($data)) { # code... $GLOBALS['data'] = $data; } if (self::exist($var)) { include(GX_THEME.THEME.'/'.$var.'.php'); }else{ Control::error('unknown','Theme file is missing.')...
Base
1
public function execute(&$params){ $action = new Actions; $action->associationType = lcfirst(get_class($params['model'])); $action->associationId = $params['model']->id; $action->subject = $this->parseOption('subject', $params); $action->actionDescription = $this->parseOption...
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
static function isSearchable() { return true; }
Base
1
public function withPath($path) { if (!is_string($path)) { throw new \InvalidArgumentException( 'Invalid path provided; must be a string' ); } $path = $this->filterPath($path); if ($this->path === $path) { return $this; ...
Base
1
public static function page($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".self::slug($vars).GX_URL_PREFIX; break; default: # code... $url = Options::ge...
Base
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, ))); }
Base
1
public function removeRemote($name) { $this->run('remote', 'remove', $name); return $this; }
Class
2
static public function getPriorityText($_lng, $_priority = 0) { switch($_priority) { case 1: return $_lng['ticket']['high']; break; case 2: return $_lng['ticket']['normal']; break; default: return $_lng['ticket']['low']; break; } }
Class
2
public static function existConf () { if(file_exists(GX_PATH.'/inc/config/config.php')){ return true; }else{ return false; } }
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
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_...
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 display_sdm_stats_meta_box($post) { //Stats metabox $old_count = get_post_meta($post->ID, 'sdm_count_offset', true); $value = isset($old_count) && $old_count != '' ? $old_count : '0'; // Get checkbox for "disable download logging" $no_logs = get_post_meta($post->ID, 'sdm_item_no_log', true); ...
Base
1
public function confirm() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask/remove', array( 'subtask' => $subtask, 'task' => $task, ))); }
Base
1
function edit() { global $user; /* 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']) ? SIMPLENOTE_REQUIRE_LOG...
Class
2
public function update_groupdiscounts() { global $db; if (empty($this->params['id'])) { // look for existing discounts for the same group $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']); if (!empty($existing_id)) flashAndFlow('er...
Base
1
$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
public function manage() { expHistory::set('manageable', $this->params); // build out a SQL query that gets all the data we need and is sortable. $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id '; $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_P...
Base
1
public static function all_in_array() { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webuser_groups WHERE website = '.protect($website->id)); $rs = $DB->result(); foreach($rs as $r...
Base
1
function edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['o...
Base
1
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 invalidate() { $name = $this->getName(); if (null !== $name) { $params = session_get_cookie_params(); $cookie_options = array ( 'expires' => time() - 42000, 'path' => $params['path'], 'domain' => $par...
Base
1
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...
Base
1
public function Set($_var = '', $_value = '', $_vartrusted = false, $_valuetrusted = false) { if ($_var != '' && $_value != '' ) { if (!$_vartrusted) { $_var = strip_tags($_var); } if (!$_valuetrusted) { $_value = strip_tags($_value, '<br />'); } if (strtolower($_var) == 'message' ...
Class
2
public static function loadElementPaths($type, $object_id, $website_id=null) { global $DB; global $website; if(empty($website_id)) $website_id = $website->id; $ok = $DB->query(' SELECT * FROM nv_paths WHERE type = '.protect($type).' AND object_id = '.protect($object_id).' ...
Base
1
public static function cat($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".$vars."/".Typo::slugify(Categories::name($vars)); break; default: # code... $u...
Compound
4
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Base
1
public function load_lines() { global $DB; $DB->query(' SELECT * FROM nv_orders_lines WHERE `order` = '.protect($this->id).' ORDER BY position ASC' ); $this->lines = $DB->result(); }
Base
1
public function testCanGetInstance() { static::assertInstanceOf('ShopwarePlugins\RestApi\Components\Router', $this->router); }
Base
1
public function manage() { expHistory::set('manageable', $this->params); // build out a SQL query that gets all the data we need and is sortable. $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id '; $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_P...
Class
2
function PMA_getUrlParams( $what, $reload, $action, $db, $table, $selected, $views, $original_sql_query, $original_url_query ) { $_url_params = array( 'query_type' => $what, 'reload' => (! empty($reload) ? 1 : 0), ); if (mb_strpos(' ' . $action, 'db_') == 1) { $_url_params['d...
Base
1
$ds = self::connectToServer($replicate["host"], $replicate["port"], $ldap_method['rootdn'], Toolbox::decrypt($ldap_method['rootdn_passwd'], GLPIKEY), $ldap_method['use_tls'], $ldap_method[...
Base
1
public function changePassword(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $uid = I("uid/d"); $new_password = I("new_password"); $return = D("User")->updatePwd($uid, $new_password); if (!$return) { $this->sendError(10101); }else{ ...
Compound
4
public function pageToContainedHtml(Page $page) { $page->html = (new PageContent($page))->render(); $pageHtml = view('pages.export', [ 'page' => $page, 'format' => 'html', ])->render(); return $this->containHtml($pageHtml); }
Base
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...
Base
1
public function testIsExpiredReturnsTrueWhenModificationTimesWarrant() { $compiler = new BladeCompiler($files = $this->getFiles(), __DIR__); $files->shouldReceive('exists')->once()->with(__DIR__.'/'.sha1('foo').'.php')->andReturn(true); $files->shouldReceive('lastModified')->once()->with...
Class
2
public function ExpandHash($project, $abbrevHash) { if (!$project) return $abbrevHash; if (!(preg_match('/[0-9A-Fa-f]{4,39}/', $abbrevHash))) { return $abbrevHash; } $args = array(); $args[] = '-1'; $args[] = '--format=format:%H'; $args[] = $abbrevHash; $fullData = explode("\n", $this->exe->E...
Base
1
public function actionGetLists() { if (!Yii::app()->user->checkAccess('ContactsAdminAccess')) { $condition = ' AND (visibility="1" OR assignedTo="Anyone" OR assignedTo="' . Yii::app()->user->getName() . '"'; /* x2temp */ $groupLinks = Yii::app()->db->createCommand()->sel...
Class
2
function manage_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all...
Base
1
public function update() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $values = $this->request->getValues(); list($valid, $errors) = $this->tagValidator->validateModification($values); ...
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
$alt = __esc('Export'); } if ($force_type != 'import' && $force_type != 'export' && $force_type != 'save' && $cancel_url != '') { $cancel_action = "<input type='button' onClick='cactiReturnTo(\"" . htmlspecialchars($cancel_url) . "\")' value='" . $calt . "'>"; } else { $cancel_action = ''; } ?> <table sty...
Base
1