code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
public function session() { // Test if logged in, log in if not, log in. try { $this->assertElementPresent('css=ul#user-menu'); } catch (PHPUnit_Framework_AssertionFailedError $e) { /* If this isn't the first time we've logged in, we have a problem; * the...
Class
2
public function rules() { return [ 'upload_receipt' => [ 'nullable', new Base64Mime(['gif', 'jpg', 'png']) ] ]; }
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 static function remove_old_unconfirmed_accounts() { global $DB; global $website; $ok = false; $DB->query(' SELECT ex.id FROM ( SELECT id, activation_key, SUBSTRING_INDEX(activation_key, "-", -1) AS expiration_time ...
Base
1
public function assignDefaultRoles() { global $gMessage, $gL10n; $this->db->startTransaction(); // every user will get the default roles for registration, if the current user has the right to assign roles // than the roles assignment dialog will be shown $sql = 'SELECT ...
Base
1
public function pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::ge...
Base
1
public function testCreateRelationshipMeta() { // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta(null, null, null, array(), null); self::assertCount(1, $GLOBALS['log']->calls['fatal']); // test $GLOBALS['log']->reset(); SugarBean::create...
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...
Class
2
$this->assertEquals(array($flashes[$key]), $val); ++$i; }
Base
1
public function search(){ // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria = new CDbCriteria; $username = Yii::app()->user->name; $criteria->addCondition("uploadedBy='$username' OR private=0 OR private=null"); ...
Class
2
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 setActive($flag) { if (PHP_VERSION_ID >= 50400) { throw new \LogicException('This method is disabled in PHP 5.4.0+'); } $this->active = (bool) $flag; }
Base
1
function selectBillingOptions() { }
Base
1
$stat = $this->stat($p); if (!$stat) { // invalid links continue; } if (!empty($stat['hidden']) || !$this->mimeAccepted($stat['mime'], $mimes)) { continue; } $name = $stat['name']; if ((!$mimes || $stat['mime'] !== 'directory') && $this->stripos($name, $q) !== false) { $stat['pat...
Base
1
$method = $this->request->get('_method', $this->query->get('_method', 'POST')); if (\is_string($method)) { $this->method = strtoupper($method); } } } }
Base
1
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_re...
Base
1
public function setBanner($banner) { $return = $this->setOneToOne($banner, Banner::class, 'banner', 'container'); $this->setType('ctBanner'); return $return; }
Base
1
public function remove() { $id = (int)$this->id; if ($this->isSystemType()) { throw new \RuntimeException(_T("You cannot delete system payment types!")); } try { $delete = $this->zdb->delete(self::TABLE); $delete->where( self::...
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 testPathMustBeValid() { (new Uri(''))->withPath([]); }
Base
1
public function handleRequest() { /* Load error handling class */ $this->loadErrorHandler(); $this->modx->invokeEvent('OnHandleRequest'); /* save page to manager object. allow custom actionVar choice for extending classes. */ $this->action = isset($_REQUEST[$this->actionVar...
Base
1
protected function configure() { $this ->setName('kimai:version') ->setDescription('Receive version information') ->setHelp('This command allows you to fetch various version information about Kimai.') ->addOption('name', null, InputOption::VALUE_NONE, 'Dis...
Base
1
public static function regdate($id){ $usr = Db::result( sprintf("SELECT * FROM `user` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1", Typo::int($id), Typo::cleanX($id) ) ); return $usr[0]->join_date; }
Base
1
static function lookup($var) { if (is_array($var)) return parent::lookup($var); elseif (is_numeric($var)) return parent::lookup(array('staff_id'=>$var)); elseif (Validator::is_email($var)) return parent::lookup(array('email'=>$var)); elseif (is_str...
Base
1
public static function addViews($id) { $botlist = self::botlist(); $nom = 0; foreach($botlist as $bot) { if(preg_match("/{$bot}/", $_SERVER['HTTP_USER_AGENT'])) { $nom = 1+$nom; }else{ $nom = 0; } } ...
Base
1
function scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); ...
Base
1
public function paramRules() { return array( 'title' => Yii::t('studio',$this->title), 'info' => Yii::t('studio',$this->info), 'modelRequired' => 'Contacts', 'options' => array( array( 'name'=>'listId', 'label'=>Yii::t('studio','List'), 'typ...
Base
1
static function displayname() { return gt("e-Commerce Category Manager"); }
Class
2
function searchName() { return gt("Calendar Event"); }
Class
2
public function store($zdb) { $data = array( 'short_label' => $this->short, 'long_label' => $this->long ); try { if ($this->id !== null && $this->id > 0) { $update = $zdb->update(self::TABLE); $update->set($data)->w...
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
function _makeExtra($value, $title = '') { global $THIS_RET; if ($THIS_RET['WITH_TEACHER_ID']) $return .= ''._with.':&nbsp;' . GetTeacher($THIS_RET['WITH_TEACHER_ID']) . '<BR>'; if ($THIS_RET['NOT_TEACHER_ID']) $return .= ''._notWith.':&nbsp;' . GetTeacher($THIS_RET['NOT_TEACHER_ID']) . '<B...
Base
1
public function testXForwarderForHeaderForForwardedRequests($xForwardedFor, $expected) { $this->setNextResponse(); $server = array('REMOTE_ADDR' => '10.0.0.1'); if (false !== $xForwardedFor) { $server['HTTP_X_FORWARDED_FOR'] = $xForwardedFor; } $this->request(...
Class
2
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') { $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; } }
Base
1
public function setting($name, $value=NULL) { global $DB; global $website; $DB->query( 'SELECT * FROM nv_settings WHERE type = "user" AND user = '.protect($this->id).' AND website = '.protect($websi...
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['requi...
Base
1
public function testPinCommentAction() { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->assertAccessIsGranted($client, '/admin/customer/1/details'); $form = $client->getCrawler()->filter('form[name=customer_comment_form]')->form(); $client->submit($form,...
Compound
4
public function changeTableInfoAction() { $field = $_REQUEST['field']; if ($field == 'pma_null') { $this->response->addJSON('field_type', ''); $this->response->addJSON('field_collation', ''); $this->response->addJSON('field_operators', ''); $this->...
Base
1
public static function dropdown($vars){ if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE "; if(isset($vars['type'])) { $where .= " `type` = '{$vars['type']}' AND "; }else{ $where .= " "; ...
Compound
4
public function showall() { global $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 ($sectionObj-...
Class
2
function read_cache( $cache_id, $check = false ) { global $cms_db; if ( $cache_id && $this->use_cache ) { if ( !$this->cache_db ) $this->cache_db = new DB_cms; $return = false; $sql = "SELECT val FROM " . $cms_db['db_cache'] . " WHERE name = '"...
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->...
Base
1
public function getPrintAndMailLink($icmsObj) { global $icmsConfig, $impresscms; $ret = ''; /* $printlink = $this->handler->_moduleUrl . "print.php?" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName); $js = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, ...
Base
1
private function updateDeadline() { try { $due_date = self::getDueDate($this->zdb, $this->_member); if ($due_date != '') { $date_fin_update = $due_date; } else { $date_fin_update = new Expression('NULL'); } $up...
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, ))); }
Class
2
static function description() { return gt("This module is for managing categories in your store."); }
Base
1
list($h, $m) = explode('.', $row['RunAt']); $main .= '<div style="' . $extra_css . '" class="phoromatic_overview_box">'; $main .= '<h1><a href="?schedules/' . $row['ScheduleID'] . '">' . $row['Title'] . '</a></h1>'; if(!empty($systems_for_schedule)) { if($row['RunAt'] > date('H.i')) { $run...
Base
1
public function urlProvider() { return array( array('http://till:test@svn.example.org/', $this->getCmd(" --username 'till' --password 'test' ")), array('http://svn.apache.org/', ''), array('svn://johndoe@example.org', $this->getCmd(" --username 'johndoe' --password ''...
Class
2
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()];
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, ))); }
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 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
private static function dumpParsedRefs( $parser, $label ) { // if (!preg_match("/Query Q/",$parser->mTitle->getText())) return ''; echo '<pre>parser mLinks: '; ob_start(); var_dump( $parser->getOutput()->mLinks ); $a = ob_get_contents(); ob_end_clean(); echo htmlspecialchars( $a, ENT_QUOTES ); echo '</...
Class
2
function __construct() { $this->render_menu_page(); }
Base
1
function process_subsections($parent_section, $subtpl) { global $db, $router; $section = new stdClass(); $section->parent = $parent_section->id; $section->name = $subtpl->name; $section->sef_name = $router->encode($section->name); $...
Class
2
function get_current_tab() { $tab_keys = array_keys($this->menu_tabs); $tab = isset( $_GET['tab'] ) ? sanitize_text_field($_GET['tab']) : $tab_keys[0]; return $tab; }
Base
1
private static function executeTag( $input, array $args, Parser $parser, PPFrame $frame ) { // entry point for user tag <dpl> or <DynamicPageList> // create list and do a recursive parse of the output $parse = new \DPL\Parse(); if ( \DPL\Config::getSetting( 'recursiveTagParse' ) ) { $input = $parser->rec...
Class
2
$body = str_replace(array("\n"), "<br />", $body); } else { // It's going elsewhere (doesn't like quoted-printable) $body = str_replace(array("\n"), " -- ", $body); } $title = $items[...
Base
1
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1
public function __construct(){ }
Compound
4
public function update_version() { // get the current version $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); // check to see if the we have a new current version and unset the old current version. if (!empty($this->params['is_current'])) { // $db...
Class
2
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
$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 __invoke(Request $request) { $this->authorize('manage modules'); $path = ModuleInstaller::unzip($request->module, $request->path); return response()->json([ 'success' => true, 'path' => $path ]); }
Base
1
$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")...
Base
1
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
Base
1
protected function decodeData($data) { if ($this->base64encode) { if (is_string($data)) { if (($data = base64_decode($data)) !== false) { $data = @unserialize($data); } else { $data = null; } } else { $data = null; } } return $data; }
Base
1
$this->markTestSkipped('Function openssl_random_pseudo_bytes need LibreSSL version >=2.1.5 or Windows system on server'); } } static::$functions = $functions; // test various string lengths for ($length = 1; $length < 64; $length++) { $key1 = $th...
Class
2
public function __construct() { global $GLOBALS; }
Base
1
public function testSmtpConnect() { $this->Mail->SMTPDebug = 4; //Show connection-level errors $this->assertTrue($this->Mail->smtpConnect(), 'SMTP single connect failed'); $this->Mail->smtpClose(); $this->Mail->Host = "ssl://localhost:12345;tls://localhost:587;10.10.10.10:54321;l...
Class
2
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...
Base
1
public function update() { global $DB; $ok = $DB->execute(' UPDATE nv_menus SET codename = :codename, icon = :icon, lid = :lid, notes = :notes, functions = :functions, enabled = :enabled WHERE id = :id', array( 'id' => $this->id, 'codename' => value_or...
Base
1
protected function AddAnAddress($kind, $address, $name = '') { if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) { $this->SetError($this->Lang('Invalid recipient array').': '.$kind); if ($this->exceptions) { throw new phpmailerException('Invalid recipient array: ' . $kind); } if ...
Base
1
public function testFirstTrustedProxyIsSetAsRemote() { $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $expectedSubRequest->server->set('REMOTE_ADDR', '1.1.1.1'); if (Request::getTrustedHeaderName(Request::H...
Class
2
public function delete($id) { $this->CRUD->delete($id); $responsePayload = $this->CRUD->getResponsePayload(); if (!empty($responsePayload)) { return $responsePayload; } $this->set('metaGroup', 'Trust Circles'); }
Class
2
protected function renderText ($field, $makeLinks, $textOnly, $encode) { $fieldName = $field->fieldName; $value = preg_replace("/(\<br ?\/?\>)|\n/"," ",$this->owner->$fieldName); return Yii::app()->controller->convertUrls($this->render ($value, $encode)); }
Class
2
public function hasHeader($header) { return isset($this->headers[strtolower($header)]); }
Base
1
public function getQueryGroupby() { return ''; }
Base
1
public function __construct() { $this->pop_conn = 0; $this->connected = false; $this->error = null; }
Base
1
protected function parseChunkedRequest(Request $request) { $totalChunkCount = $request->get('dztotalchunkcount'); $index = $request->get('dzchunkindex'); $last = ((int) $index + 1) === (int) $totalChunkCount; $uuid = $request->get('dzuuid'); /** * @var UploadedF...
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['requi...
Class
2
function logon($username, $password, &$sessionId) { global $_POST, $_COOKIE; global $strUsernameOrPasswordWrong; /** * @todo Please check if the following statement is in correct place because * it seems illogical that user can get session ID from internal login with ...
Compound
4
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
public function __invoke(Request $request, Expense $expense) { $this->authorize('update', $expense); $data = json_decode($request->attachment_receipt); if ($data) { if ($request->type === 'edit') { $expense->clearMediaCollection('receipts'); } ...
Base
1
public static function setArray( $arg ) { $numargs = count( $arg ); if ( $numargs < 5 ) { return ''; } $var = trim( $arg[2] ); $value = $arg[3]; $delimiter = $arg[4]; if ( $var == '' ) { return ''; } if ( $value == '' ) { self::$memoryArray[$var] = []; return; } if ( $delimi...
Class
2
public static function sitemap() { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/sitemap".GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')....
Base
1
protected function assertCsvUploaded($csv) { $uploadedPath = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'data', 'data.csv' )); $this->assertFileExists ($uploadedPath); $this->assertFileEquals ($csv, $uploadedPath); }
Class
2
private function mail_passthru($to, $subject, $body, $header, $params) { if ( ini_get('safe_mode') || !($this->UseSendmailOptions) ) { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header); } else { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subjec...
Class
2
public function testGetFilteredEventsDataProvider () { TestingAuxLib::loadX2NonWebUser (); TestingAuxLib::suLogin ('testuser'); Yii::app()->settings->historyPrivacy = null; $profile = Profile::model()->findByAttributes(array('username' => 'testuser')); $retVal = Events::getFi...
Class
2
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
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 check(&$params){ $tags = $this->config['options']['tags']['value']; $tags = is_array($tags) ? $tags : Tags::parseTags($tags, true); if(!empty($tags) && isset($params['tags'])){ // Check passed params to be sure they're set if(!is_array($params['tags'])){ ...
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'), ...
Class
2
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
Class
2
} elseif ($this->isValidOrderKey($o)) { $this->orderKey[] = '`' . $o . '`'; } } }
Base
1
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,n...
Base
1
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 defaultCurrency(Request $request, TransactionCurrency $currency) { app('preferences')->set('currencyPreference', $currency->code); app('preferences')->mark(); Log::channel('audit')->info(sprintf('Make %s the default currency.', $currency->code)); $this->reposito...
Compound
4
public function manage_messages() { expHistory::set('manageable', $this->params); $page = new expPaginator(array( 'model'=>'order_status_messages', 'where'=>1, 'limit'=>10, 'order'=>'body', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), ...
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