code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
public function getSupportedBrands() { return array( static::BRAND_VISA => '/^4\d{12}(\d{3})?$/', static::BRAND_MASTERCARD => '/^(5[1-5]\d{4}|677189)\d{10}$/', static::BRAND_DISCOVER => '/^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/', static::BRAND_AMEX =>...
Base
1
function singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
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 { ...
Class
2
function render_menu_tabs() { $current_tab = $this->get_current_tab(); echo '<h2 class="nav-tab-wrapper">'; foreach ( $this->menu_tabs as $tab_key => $tab_caption ) { $active = $current_tab == $tab_key ? 'nav-tab-active' : ''; echo '<a class="na...
Base
1
public function setContainer($container) { $this->container = $container; $container->setType('ctBanner'); }
Base
1
public function refreshUser(UserInterface $user) { $user = $this->inner->refreshUser($user); $alterUser = \Closure::bind(function (InMemoryUser $user) { $user->password = 'foo'; }, null, class_exists(User::class) ? User::class : InMemoryUser::class); $alterUser($user); return $...
Compound
4
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
Class
2
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 configure() { $this->config['defaultbanner'] = array(); if (!empty($this->config['defaultbanner_id'])) { $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']); } parent::configure(); $banners = $this->banner->find('all', nul...
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.")); ...
Base
1
public static function getIconName($module) { return isset(static::$iconNames[$module]) ? static::$iconNames[$module] : strtolower(str_replace('_', '-', $module)); }
Base
1
protected function imageExtensions() { return [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'svg' ]; }
Base
1
public static function editParam($param, $value, $post_id) { $sql = "UPDATE `posts_param` SET `value` = '{$value}' WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' "; $q = Db::query($sql); if ($q) { return true; }else{ return false; } ...
Base
1
protected function fixupImportedAttributes($modelName, X2Model &$model) { if ($modelName === 'Contacts' || $modelName === 'X2Leads') $this->fixupImportedContactName ($model); if ($modelName === 'Actions' && isset($model->associationType)) $this->reconstructImportedActionAsso...
Class
2
public static function getIconName($module) { return isset(static::$iconNames[$module]) ? static::$iconNames[$module] : strtolower(str_replace('_', '-', $module)); }
Class
2
public function actionGetItems(){ $sql = 'SELECT id, name as value, subject FROM x2_bug_reports WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $resul...
Class
2
public function attorn(){ $login_user = $this->checkLogin(); $username = I("username"); $item_id = I("item_id/d"); $password = I("password"); $item = D("Item")->where("item_id = '$item_id' ")->find(); if(!$this->checkItemManage($login_user['uid'] , $item['item_id'...
Compound
4
private function initProfileFieldFilter(ProfileField $profileField, $sortOrder = 1000) { $profileFieldType = $profileField->getFieldType(); if (!$profileFieldType) { return; } $definition = $profileFieldType->getFieldFormDefinition(); $fieldType = isset($def...
Base
1
foreach ($nodes as $node) { if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) { if ($node->active == 1) { $text = str_pad('', ($depth + ($full ...
Base
1
public function execute(&$params){ $options = &$this->config['options']; $event = new Events; $notif = new Notification; $user = $this->parseOption('user', $params); $type = $this->parseOption('type', $params); if($type === 'auto'){ if(!isset($params['...
Class
2
foreach ($days as $event) { if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break; if (empty($event->eventstart)) $eve...
Base
1
function can_process($new) { if (strlen($_POST['user_id']) < 4) { display_error( _('The user login entered must be at least 4 characters long.')); set_focus('user_id'); return false; } if (!$new && ($_POST['password'] != '')) { if (strlen($_POST['password']) < 4) { display_error( _('The password entered ...
Base
1
protected function _dimensions($path, $mime) { if (strpos($mime, 'image') !== 0) return ''; $cache = $this->getDBdat($path); if (isset($cache['width']) && isset($cache['height'])) { return $cache['width'].'x'.$cache['height']; } $ret = ''; if ($work = $this->getWorkFile($path)) { if ($size = @getimag...
Base
1
public function limit($value) { if ($value >= 0) { $this->limit = $value; } return $this; }
Base
1
public function testTransactionSearch() { $transactionSearch = $this->gateway->transactionSearch(array( 'startDate' => '2015-01-01', 'endDate' => '2015-12-31' )); $this->assertInstanceOf('\Omnipay\PayPal\Message\ExpressTransactionSearchRequest', $transactionSearc...
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 {...
Base
1
$modelName = ucfirst ($module->name); if (class_exists ($modelName)) { // prefix widget class name with custom module model name and a delimiter $cache[$widgetType][$modelName.'::TemplatesGridViewProfileWidget'] = ...
Base
1
function searchCategory() { return gt('Event'); }
Base
1
public static function backend($vars="") { if(!empty($_GET['page'])) { self::incBack($_GET['page']); }else{ self::incBack('default'); } }
Base
1
public static function getDueDate(Db $zdb, $member_id) { if (!$member_id) { return ''; } try { $select = $zdb->select(self::TABLE, 'c'); $select->columns( array( 'max_date' => new Expression('MAX(date_fin_cotis)') ...
Base
1
public function uninstall($templatename) { if (Permission::model()->hasGlobalPermission('templates', 'update')) { if (!Template::hasInheritance($templatename)) { TemplateConfiguration::uninstall($templatename); } else { Yii::app()->setFlashMessage(...
Compound
4
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
Base
1
function searchName() { return gt("Calendar Event"); }
Base
1
public function confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $swimlane, ))); }
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_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 function renameUser($new_name) { // Rename only if a new name is really new if ($this->userName != $new_name) { // Save old name $old_name = $this->userName; // Rename user $this->userName = $new_name; $this->save(); ...
Base
1
public function uploadImage() { $filesCheck = array_filter($_FILES); if (!empty($filesCheck) && $this->approvedFileExtension($_FILES['file']['name'], 'image') && strpos($_FILES['file']['type'], 'image/') !== false) { ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '10M'); $tempFile = $_FI...
Base
1
public function getHtmlForControlButtons() { $ret = ''; $cfgRelation = PMA_getRelationsParam(); if ($cfgRelation['navwork']) { $db = $this->realParent()->real_name; $item = $this->real_name; $ret = '<span class="navItemControls">' . ...
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...
Base
1
private static function sign($input, $key, $algo = 'HS256') { switch ($algo) { case 'HS256': return hash_hmac('sha256', $input, $key, true); case 'HS384': return hash_hmac('sha384', $input, $key, true); case 'HS512': ...
Class
2
public static function dplReplaceParserFunction( &$parser, $text, $pat = '', $repl = '' ) { $parser->addTrackingCategory( 'dplreplace-parserfunc-tracking-category' ); if ( $text == '' || $pat == '' ) { return ''; } # convert \n to a real newline character $repl = str_replace( '\n', "\n", $repl ); # rep...
Class
2
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-",...
Base
1
. PMA_Util::getIcon('b_favorite.png') . '</a>'; $html .= '<a href="sql.php?server=' . $GLOBALS['server'] . '&db=' . $table['db'] . '&table=' . $table['table'] . '&token=' . ...
Base
1
$tokens = preg_split( '/ - */', $title ); $newKey = ''; foreach ( $tokens as $token ) { $initial = substr( $token, 0, 1 ); if ( $initial >= '1' && $initial <= '7' ) { $newKey .= $initial; $suit = substr( $token, 1 ); if ( $suit == '♣' ) { $newKey .= '1'; } elseif ( $suit == '...
Class
2
public function testReturnsAsIsWhenNoChanges() { $request = new Psr7\Request('GET', 'http://foo.com'); $this->assertSame($request, Psr7\modify_request($request, [])); }
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
function check_file_dir_name($label) { if (empty($label) || preg_match('/[^A-Za-z0-9_.-]/', $label)) die(xlt("ERROR: The following variable contains invalid characters").": ". attr($label)); }
Class
2
public function validate() { global $db; // check for an sef url field. If it exists make sure it's valid and not a duplicate //this needs to check for SEF URLS being turned on also: TODO if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) { ...
Base
1
function get_language_attributes( $doctype = 'html' ) { $attributes = array(); if ( function_exists( 'is_rtl' ) && is_rtl() ) $attributes[] = 'dir="rtl"'; if ( $lang = get_bloginfo('language') ) { if ( get_option('html_type') == 'text/html' || $doctype == 'html' ) $attributes[] = "lang=\"$lang\""; if ( g...
Base
1
public static function isActive () { switch (SMART_URL) { case true: if (Options::v('multilang_enable') === 'on') { $langs = Session::val('lang'); if($langs != '') { $lang = Session::val('lang'); ...
Base
1
private function _addfirstcategorydate( $option ) { //@TODO: This should be programmatically determining which categorylink table to use instead of assuming the first one. $this->addSelect( [ 'cl_timestamp' => "DATE_FORMAT(cl1.cl_timestamp, '%Y%m%d%H%i%s')" ] ); }
Class
2
$section = new section(intval($page)); if ($section) { // self::deleteLevel($section->id); $section->delete(); } } }
Base
1
foreach ($indexesOld as $index) { if (\in_array('name', $index->getColumns()) || \in_array('mail', $index->getColumns())) { $this->indexesOld[] = $index; $this->addSql('DROP INDEX ' . $index->getName() . ' ON ' . $users); } }
Compound
4
public function setModel(Model $model) { $this->model = $model; $this->extensions = $this->model->getAllowedExtensions(); $this->from($this->model->getObjectTypeDirName()); return $this; }
Base
1
public static function login() { user::login(expString::sanitize($_POST['username']),expString::sanitize($_POST['password'])); if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in flash('error', gt('Invalid Username / Password')); if (expSession::is_set('redirecturl_error')) { ...
Base
1
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
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
Base
1
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) { if ($is_revisioned) { $object->revision_id++; //if ($table=="text") eDebug($object); $res = $this->insertObject($object, $table); //if ($table=="text") eDebug($objec...
Base
1
public function testNewInstanceWhenAddingHeader() { $r = new Response(200, ['Foo' => 'Bar']); $r2 = $r->withAddedHeader('Foo', 'Baz'); $this->assertNotSame($r, $r2); $this->assertEquals('Bar, Baz', $r2->getHeaderLine('foo')); }
Base
1
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('orders_status.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
Base
1
function edit_freeform() { $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 delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->par...
Base
1
function edit_externalalias() { $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
public function store(CurrencyFormRequest $request) { /** @var User $user */ $user = auth()->user(); $data = $request->getCurrencyData(); if (!$this->userRepository->hasRole($user, 'owner')) { Log::error('User ' . auth()->user()->id . ' is not admin, but tried to sto...
Compound
4
function mso_segment_array() { $CI = &get_instance(); if (isset($_SERVER['REQUEST_URI']) and $_SERVER['REQUEST_URI']) { // http://localhost/page/privet?get=hello $url = getinfo('site_protocol'); $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $url = str_replace($CI->config->config['base_url'...
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 test_empty_content_multiple_spaces() { $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => ' ', ), ) ); $this->assertIXRError( $result ); $this->assertSame( 403, $result->code ); ...
Class
2
public static function dplChapterParserFunction( &$parser, $text = '', $heading = ' ', $maxLength = -1, $page = '?page?', $link = 'default', $trim = false ) { $parser->addTrackingCategory( 'dplchapter-parserfunc-tracking-category' ); $output = \DPL\LST::extractHeadingFromText( $parser, $page, '?title?', $text, $he...
Class
2
public function query($sql, $fetch_mode='object') { $this->lastError = ''; $this->lastResult = ''; switch($fetch_mode) { case 'array': $fetch = PDO::FETCH_ASSOC; break; case 'object': default: $fetch = PDO::FETCH_OBJ; break; } try { $statement = $t...
Base
1
public function getQueryGroupby() { // SubmittedOn is stored in the artifact return 'a.submitted_on'; }
Base
1
function __construct() { $this->mDb = GlobalNewFilesHooks::getGlobalDB( DB_REPLICA, 'gnf_files' ); if ( $this->getRequest()->getText( 'sort', 'files_date' ) == 'files_date' ) { $this->mDefaultDirection = IndexPager::DIR_DESCENDING; } else { $this->mDefaultDirection = IndexPager::DIR_ASCENDING; } pare...
Class
2
function escape_command($command) { return preg_replace("/(\\\$|`)/", "", $command); }
Base
1
public static function unpublish($id) { $id = Typo::int($id); $ins = array( 'table' => 'posts', 'id' => $id, 'key' => array( 'status' => '0' ) ); $...
Base
1
public function __construct () { if (self::existConf()) { # code... self::config('config'); self::lang(GX_LANG); }else{ GxMain::install(); } }
Base
1
$path = Helpers::isAbsolute($item) ? $item : ($this->getRepositoryPath() . DIRECTORY_SEPARATOR . $item); if (!file_exists($path)) { throw new GitException("The path at '$item' does not represent a valid file."); } $this->run('add', $item); }
Class
2
public static function run() { //print_r(self::$hooks[$var]); $hooks = self::$hooks; $num_args = func_num_args(); $args = func_get_args(); // print_r($args); // if($num_args < 2) // trigger_error("Insufficient arguments", E_USER_ERROR); /...
Base
1
public function getAdminViewItemLink($icmsObj, $onlyUrl=false, $withimage=false) { $ret = $this->handler->_moduleUrl . "admin/" . $this->handler->_page . "?op=view&amp;" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName); if ($onlyUrl) { return $ret; } elseif ($withima...
Base
1
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
Base
1
public function uploadCompanyLogo(Request $request) { $company = Company::find($request->header('company')); $this->authorize('manage company', $company); $data = json_decode($request->company_logo); if ($data) { $company = Company::find($request->header('company')...
Base
1
public function __construct(?string $message = null) { if ($message === null) { $message = _('Invalid email/password combination.'); } parent::__construct($message, 0); }
Base
1
public function getTopRated(){ $url = "http://api.themoviedb.org/3/movie/top_rated?api_key=".$this->apikey; $top_rated = $this->curl($url); return $top_rated; }
Base
1
public function update_discount() { $id = empty($this->params['id']) ? null : $this->params['id']; $discount = new discounts($id); // find required shipping method if needed if ($this->params['required_shipping_calculator_id'] > 0) { $this->params['required_shipping_metho...
Base
1
public function setFrameAncestors(Response $response) { $iframeHosts = $this->getAllowedIframeHosts(); array_unshift($iframeHosts, "'self'"); $cspValue = 'frame-ancestors ' . implode(' ', $iframeHosts); $response->headers->set('Content-Security-Policy', $cspValue, false); }
Base
1
public function actionDeleteDropdown() { $dropdowns = Dropdowns::model()->findAll(); if (isset($_POST['dropdown'])) { if ($_POST['dropdown'] != Actions::COLORS_DROPDOWN_ID) { $model = Dropdowns::model()->findByPk($_POST['dropdown']); $model->delete(); ...
Class
2
$controller = new $ctlname(); if (method_exists($controller,'isSearchable') && $controller->isSearchable()) { // $mods[$controller->name()] = $controller->addContentToSearch(); $mods[$controller->searchName()] = $controller->addContentToSearch(); } } uksort($mods,'str...
Base
1
function ngettext($single, $plural, $number) { if ($this->short_circuit) { if ($number != 1) return $plural; else return $single; } // find out the appropriate form $select = $this->select_string($number); // this should contains all strings separated by NULLs $ke...
Base
1
echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />'; }
Compound
4
public function validate() { global $db; // check for an sef url field. If it exists make sure it's valid and not a duplicate //this needs to check for SEF URLS being turned on also: TODO if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) { ...
Class
2
public function showall() { expHistory::set('viewable', $this->params); $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'show...
Class
2
public function getQuerySelect() { }
Base
1
function invalidTestController($port) { $host = php_uname('n'); $filename = __DIR__.'/request-doesnotexist.dat'; $file = fopen($filename, 'rb'); $req_dat = fread($file, filesize($filename)); fclose($file); // Repeat the data three times, to make it invalid. This particular bytestream // (and ones like i...
Class
2
protected function LoadSize($blob) { if (!$blob) return; $args = array(); $args[] = '-s'; $args[] = $blob->GetHash(); return $this->exe->Execute($blob->GetProject()->GetPath(), GIT_CAT_FILE, $args); }
Base
1
function delete() { global $db; if (empty($this->params['id'])) return false; $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']); $product = new $product_type($this->params['id'], true, false); //eDebug($product_type); //eDebug...
Base
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
public function start() { if ($this->started) { return true; } $this->loadSession(); if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { // This condition matches only PHP 5.3 + internal save handlers $t...
Base
1
protected function Start() { $sCurrentStepClass = $this->sInitialStepClass; $oStep = new $sCurrentStepClass($this, $this->sInitialState); $this->DisplayStep($oStep); }
Base
1
unlink($file); } foreach (self::$tempImages as $versions) { foreach ($versions as $file) { if ($file === self::$broken_image) { continue; } if ($debugPng) { print "[unlink temp image $file]";...
Base
1
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); if ($input->getOption('semver')) { $io->writeln(Constants::VERSION . '-' . Constants::STATUS); return 0; } if ($input->getOption('short...
Base
1
$contents = ['form' => tep_draw_form('currencies', 'currencies.php', 'page=' . $_GET['page'] . (isset($cInfo) ? '&cID=' . $cInfo->currencies_id : '') . '&action=insert')];
Base
1