code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
public function getList($location, $features, $etag, $mediatypes) { $featuresArray = explode(';', $features); $mediaTypesArray = explode(';', $mediatypes); try { return $this->getFilesAndAlbums($location, $featuresArray, $etag, $mediaTypesArray); } catch (\Exception $exception) { return $this->jsonError(...
Base
1
public static function delete($id){ return Categories::delete($id); }
Base
1
public function __construct(ImageService $imageService, PdfGenerator $pdfGenerator) { $this->imageService = $imageService; $this->pdfGenerator = $pdfGenerator; }
Base
1
public function addTags($tags) { $result = false; $addedTags = array(); foreach ((array) $tags as $tagName) { if (empty($tagName)) continue; if (!in_array($tagName, $this->getTags())) { // check for duplicate tag $tag = new Tags; ...
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 testCanCreateNewResponseWithStatusAndReason() { $r = new Response(200); $r2 = $r->withStatus(201, 'Foo'); $this->assertEquals(200, $r->getStatusCode()); $this->assertEquals('OK', $r->getReasonPhrase()); $this->assertEquals(201, $r2->getStatusCode()); ...
Base
1
public function getZipFile($path) { $filename = basename($path); // echo "<pre>"; // echo $path."\n"; // echo $filename."\n"; // echo "isFile => ".is_file($path) ? 'isFile' : 'isNoFile'."\n"; // echo "</pre>"; if (is_file($path) || true) { // Send...
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
public function load($id) { try { $select = $this->zdb->select(self::TABLE, 't'); $select->where(self::PK . ' = ' . $id); $select->join( array('a' => PREFIX_DB . Adherent::TABLE), 't.' . Adherent::PK . '=a.' . Adherent::PK, ...
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
$_fn[] = self::buildCondition($v, ' && '); } $fn[] = '('.\implode(' || ', $_fn).')'; break; case '$where': if (\is_callable($value)) { // need implementation ...
Base
1
private function createSink(StreamInterface $stream, array $options) { if (!empty($options['stream'])) { return $stream; } $sink = isset($options['sink']) ? $options['sink'] : fopen('php://temp', 'r+'); return is_string($sink) ? n...
Base
1
public function setLinks($links) { $return = $this->setOneToMany($links, Link::class, 'links', 'container'); $this->setType('ctLinks'); return $return; }
Base
1
public static function access ($grp='4') { if ( isset($_SESSION['gxsess']['val']['group']) ) { if($_SESSION['gxsess']['val']['group'] <= $grp) { return true; }else{ return false; } } }
Base
1
public function testPages () { $this->visitPages ( $this->allPages ); }
Base
1
public static function withQueryValue(UriInterface $uri, $key, $value) { $current = $uri->getQuery(); $key = strtr($key, self::$replaceQuery); if (!$current) { $result = []; } else { $result = []; foreach (explode('&', $current) as $part) { ...
Base
1
public function testInfoWithoutUrl() { $this->assertRequestIsRedirect('info'); }
Base
1
function edit_vendor() { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); assign_to_template(array( 'vendor'=>$vendor )); } }
Class
2
function &getAll(&$dbh, $proposalId) { $sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS timestamp FROM package_proposal_votes WHERE pkg_prop_id = ". $dbh->quoteSmart($proposalId) ." ORDER BY timestamp ASC"; $res = $dbh->query($sql); if (DB::isError($res)) { return $res; ...
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
public static function getHost() { if (isset($_SERVER['HTTP_HOST'])) { $site_address = (erLhcoreClassSystem::$httpsMode == true ? 'https:' : 'http:') . '//' . $_SERVER['HTTP_HOST'] ; } else if (class_exists('erLhcoreClassInstance')) { $site_address = 'https://' . erLhcoreCla...
Class
2
public function actionHideWidget() { if (isset($_POST['name'])) { $name = $_POST['name']; $layout = Yii::app()->params->profile->getLayout(); // the widget could be in any of the blocks in the page, so check all of them foreach ($layout as $b => &$block) { ...
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 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
public static function makeConfig ($file) { $config = "<?php if(!defined('GX_LIB')) die(\"Direct Access Not Allowed!\"); /** * GeniXCMS - Content Management System * * PHP Based Content Management System and Framework * * @package GeniXCMS * @since 0.0.1 build date 20140925 * @version 0.0.1 * @link https:/...
Base
1
public function getQueryGroupby() { $R1 = 'R1_' . $this->id; $R2 = 'R2_' . $this->id; return "$R2.value"; }
Base
1
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1
addChangeLogEntry($request["logid"], NULL, unixToDatetime($end), $request['start'], NULL, NULL, 0); return array('status' => 'error', 'errorcode' => 44, 'errormsg' => 'concurrent license restriction'); }
Class
2
echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\n" ); } }
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 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
$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('countries.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
Base
1
public static function insert($vars) { if(is_array($vars)) { $slug = Typo::slugify($vars['title']); $vars = array_merge($vars, array('slug' => $slug)); //print_r($vars); $ins = array( 'table' => 'options', 'key' ...
Base
1
public function Quit($close_on_error = true) { $this->error = null; // so there is no confusion if(!$this->connected()) { $this->error = array( "error" => "Called Quit() without being connected"); return false; } // send the quit command to the server fputs($this->smtp_...
Class
2
public static function rpc ($url) { new Pinger(); //require_once( GX_LIB.'/Vendor/IXR_Library.php' ); $url = 'http://'.$url; $client = new IXR_Client( $url ); $client->timeout = 3; $client->useragent .= ' -- PingTool/1.0.0'; $client->debug = false; ...
Base
1
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
Base
1
function import() { $pullable_modules = expModules::listInstalledControllers($this->baseclassname); $modules = new expPaginator(array( 'records' => $pullable_modules, 'controller' => $this->loc->mod, 'action' => $this->params['action'], 'order' ...
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...
Class
2
public function setHeadItemAttributes( $attributes ) { $this->headItemAttributes = \Sanitizer::fixTagAttributes( $attributes, 'li' ); }
Class
2
public function skip($value) { return $this->offset($value); }
Base
1
recyclebin::sendToRecycleBin($loc, $parent); //FIXME if we delete the module & sectionref the module completely disappears // if (class_exists($secref->module)) { // $modclass = $secref->module; // //FIXME: more module/controller glue code // ...
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_comments WHERE website = '.protect($website->id), 'object' ); $out = $DB->result(); if($type='json') ...
Base
1
public function __construct() { }
Base
1
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
Class
2
$files[$key]->save(); } // eDebug($files,true); }
Base
1
$src = substr($ref->source, strlen($prefix)) . $section->id; if (call_user_func(array($ref->module, 'hasContent'))) { $oloc = expCore::makeLocation($ref->module, $ref->source); $nloc = expCore::makeLocation($ref->module, $src); if ($ref->module...
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...
Compound
4
public function testGetEventsPublicProfile(){ TestingAuxLib::loadX2NonWebUser (); TestingAuxLib::suLogin ('testuser'); Yii::app()->settings->historyPrivacy = null; $lastEventId=0; $lastTimestamp=0; $myProfile = Profile::model()->findByAttributes(array('username' => '...
Base
1
function captureAuthorization() { //eDebug($this->params,true); $order = new order($this->params['id']); /*eDebug($this->params); //eDebug($order,true);*/ //eDebug($order,true); //$billing = new billing(); //eDebug($billing, true); //$billing->calcul...
Base
1
public function behaviors() { return array_merge(parent::behaviors(),array( 'X2LinkableBehavior'=>array( 'class'=>'X2LinkableBehavior', 'module'=>'marketing' ), 'ERememberFiltersBehavior' => array( 'class'=>'application.components.ERememberFiltersBehavior', 'defaults'=>array(), 'defaultS...
Class
2
function ttValidDate($val) { $val = trim($val); if (strlen($val) == 0) return false; // This should accept a string in format 'YYYY-MM-DD', 'MM/DD/YYYY', 'DD-MM-YYYY', 'DD.MM.YYYY', or 'DD.MM.YYYY whatever'. if (!preg_match('/^\d\d\d\d-\d\d-\d\d$/', $val) && !preg_match('/^\d\d\/\d\d\/\d\d\d\d$/', $val...
Base
1
$src = substr($ref->source, strlen($prefix)) . $section->id; if (call_user_func(array($ref->module, 'hasContent'))) { $oloc = expCore::makeLocation($ref->module, $ref->source); $nloc = expCore::makeLocation($ref->module, $src); if ($ref->module...
Class
2
public static function makeConfig ($file) { $config = "<?php if(!defined('GX_LIB')) die(\"Direct Access Not Allowed!\"); /** * GeniXCMS - Content Management System * * PHP Based Content Management System and Framework * * @package GeniXCMS * @since 0.0.1 build date 20140925 * @version 0.0.1 * @link https:/...
Base
1
public function get_view_config() { global $template; // set paths we will search in for the view $paths = array( BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure', BASE.'framework/modules/common/views/file/configure', ); fo...
Base
1
public function sdm_save_thumbnail_meta_data($post_id) { // Save Thumbnail Upload metabox if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; if (!isset($_POST['sdm_thumbnail_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_thumbnail_box_nonce_check'], 'sdm_thumbnail_box_nonce')) return; if (i...
Base
1
function scan($dir, $filter = '') { $path = FM_ROOT_PATH.'/'.$dir; $ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $rii = new RegexIterator($ite, "/(".$filter.")/i"); $files = array(); foreach ($rii as $file) { if (!$file->isDir()) { $fileName = $f...
Base
1
protected function getFile() { $task_id = $this->request->getIntegerParam('task_id'); $file_id = $this->request->getIntegerParam('file_id'); $model = 'projectFileModel'; if ($task_id > 0) { $model = 'taskFileModel'; $project_id = $this->taskFinderModel->g...
Class
2
public static function update_object_score($object, $object_id) { global $DB; list($votes, $score) = webuser_vote::calculate_object_score($object, $object_id); $table = array( 'item' => 'nv_items', 'structure' => 'nv_structure', 'product' => 'nv_products' ); if(empty($table[$object...
Base
1
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')....
Compound
4
public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) { $config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'globalnewfiles' ); if ( $config->get( 'CreateWikiDatabase' ) === $config->get( 'DBname' ) ) { $updater->addExtensionTable( 'gnf_files', __DIR__ ...
Class
2
public function merge($branch, $options = NULL) { $this->run('merge', $options, $branch); return $this; }
Class
2
function change_pass() { global $txp_user; extract(psa(array('new_pass', 'mail_password'))); if (empty($new_pass)) { author_list(array(gTxt('password_required'), E_ERROR)); return; } $rs = change_user_password($txp_user, $new_pass); if ($rs) { $message = gTxt('passwo...
Base
1
public static function getHelpVersionId($version) { global $db; return $db->selectValue('help_version', 'id', 'version="'.$version.'"'); }
Base
1
protected function assertCsvUploaded($csv) { $uploadedPath = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'data', 'data.csv' )); $this->assertFileExists ($uploadedPath); $this->assertFileEquals ($csv, $uploadedPath); }
Base
1
public function __invoke(Request $request) { $this->authorize('manage modules'); $response = ModuleInstaller::upload($request); return response()->json($response); }
Base
1
function searchByModelForm() { // get the search terms $terms = $this->params['search_string']; $sql = "model like '%" . $terms . "%'"; $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10; $page = new expPaginator(array( 'model' => 'produc...
Class
2
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...
Class
2
$links[] = CHtml::link(CHtml::encode($tag->tag),array('/search/search','term'=>CHtml::encode($tag->tag)));
Base
1
public function actionView($id) { $model = CActiveRecord::model('Docs')->findByPk($id); if (!$this->checkPermissions($model, 'view')) $this->denied (); if(isset($model)){ $permissions=explode(", ",$model->editPermissions); if(in_array(Yii::app()->user->getName(),$permissions)) $editFlag=true; ...
Class
2
public function getMovieData($id){ $getMovie = $this->getMovie($id); $getCast = $this->getCast($id); $getImage = $this->getImage($id); $data = array_merge($getMovie, $getCast); $data = array_merge($data, $getImage); return $data; }
Base
1
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar');
Base
1
public function testRedirectLinkGeneration () { Yii::app()->controller = new MarketingController ( 'campaign', new MarketingModule ('campaign', null)); $_SERVER['SERVER_NAME'] = 'localhost'; $cmb = $this->instantiate(); $contact = $this->contacts('testUser_unsent'); ...
Base
1
$ul->appendChild(new XMLElement('li', $s->get('navigation_group'))); $groups[] = $s->get('navigation_group'); }
Base
1
public function getDisplayName ($plural=true) { return Yii::t('calendar', 'Calendar'); }
Base
1
public function approve_toggle() { global $history; if (empty($this->params['id'])) return; /* 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 $r...
Base
1
function phpAds_SessionStart() { global $session; if (empty($_COOKIE['sessionID'])) { $session = array(); $_COOKIE['sessionID'] = md5(uniqid('phpads', 1)); phpAds_SessionSetAdminCookie('sessionID', $_COOKIE['sessionID']); } return $_COOKIE['sessionID']; }
Compound
4
protected function _unpack($path, $arc) { die('Not yet implemented. (_unpack)'); return false; }
Base
1
public function enableCurrency(TransactionCurrency $currency) { app('preferences')->mark(); $this->repository->enable($currency); session()->flash('success', (string) trans('firefly.currency_is_now_enabled', ['name' => $currency->name])); Log::channel('audit')->info(sprintf('Ena...
Compound
4
self::removeLevel($kid->id); } }
Base
1
public static function available($username, $website_id) { global $DB; // remove spaces and make username lowercase (only to compare case insensitive) $username = trim($username); $username = mb_strtolower($username); $data = NULL; if($DB->query('SELECT COUNT(*) as total FROM nv_web...
Base
1
public function authenticate($website, $username, $password) { global $DB; global $events; $username = trim($username); $username = mb_strtolower($username); $A1 = md5($username.':'.APP_REALM.':'.$password); $website_check = ''; if($website > 0) $website_check = 'AND ...
Base
1
return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C2(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C3']) ? $this->services['Symfony...
Base
1
public function __toString() { return self::createUriString( $this->scheme, $this->getAuthority(), $this->getPath(), $this->query, $this->fragment ); }
Base
1
public function shouldRun(DateTime $date) { global $timedate; $runDate = clone $date; $this->handleTimeZone($runDate); $cron = Cron\CronExpression::factory($this->schedule); if (empty($this->last_run) && $cron->isDue($runDate)) { return true; } ...
Class
2
public function delete() { global $db; /* 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']) ? COMMENTS_REQUIRE_LO...
Class
2
$description = "User (" . $this->User->id . "): " . $this->Auth->user('email'); $fieldsResult = "Password changed."; } // query $this->Log = ClassRegistry::init('Log'); $this->Log->create(); $this->Log->save(array( 'org' => $this->Auth->user('...
Class
2
form_selectable_cell('<a class="linkEditMain" href="' . html_escape('automation_networks.php?action=edit&id=' . $network['id']) . '">' . $network['name'] . '</a>', $network['id']); form_selectable_cell($network['data_collector'], $network['id']); form_selectable_cell($sched_types[$network['sched_type']], $netw...
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('customer_data_groups.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
Base
1
public function beforeFilter() { parent::beforeFilter(); $this->Security->unlockedActions = array_merge($this->Security->unlockedActions, array('setHomePage')); }
Base
1
private function encloseForCSV($field) { return '"' . cleanCSV($field) . '"'; }
Base
1
public function testCanCreateNewResponseWithStatusAndNoReason() { $r = new Response(200); $r2 = $r->withStatus(201); $this->assertEquals(200, $r->getStatusCode()); $this->assertEquals('OK', $r->getReasonPhrase()); $this->assertEquals(201, $r2->getStatusCode()); $t...
Base
1
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
Class
2
public function SetFrom($address, $name = '', $auto = 1) { $address = trim($address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim if (!$this->ValidateAddress($address)) { $this->SetError($this->Lang('invalid_address').': '. $address); if ($this->exceptions) { ...
Base
1
public static function parseAndTrim($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); // global $db; $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_re...
Base
1
function productFeed() { // global $db; //check query password to avoid DDOS /* * condition = new * description * id - SKU * link * price * title * brand - manufacturer ...
Base
1
function __construct($apikey){ $this->apikey = $apikey; $this->config = $this->getConfig($apikey); //echo $this->apikey; }
Base
1
public function getPurchaseOrderByJSON() { if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchase_order->find('all'); } echo json_encode($purchase_orders); }
Base
1
function import() { $pullable_modules = expModules::listInstalledControllers($this->baseclassname); $modules = new expPaginator(array( 'records' => $pullable_modules, 'controller' => $this->loc->mod, 'action' => $this->params['action'], 'order' ...
Base
1
$parser->getOutput()->mTemplates[$nsp] = array_diff_assoc( $parser->getOutput()->mTemplates[$nsp], self::$createdLinks[1][$nsp] ); // echo ("<pre> elim: parser Tpls [$nsp] nachher = ". count($parser->getOutput()->mTemplates[$nsp]) ."</pre>\n"); if ( count( $parser->getOutput()->mTemplates[$nsp] ) == 0 ...
Class
2
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