code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
private function renderInvoice(InvoiceQuery $query, Request $request) { // use the current request locale as fallback, if no translation was configured if (null !== $query->getTemplate() && null === $query->getTemplate()->getLanguage()) { $query->getTemplate()->setLanguage($request->...
Base
1
public function lists($column, $key = null) { $select = is_null($key) ? [$column] : [$column, $key]; if (!is_null($this->cacheMinutes)) { $results = $this->getCached($select); } else { $results = $this->getFresh($select); } $collection = ...
Base
1
function remove() { global $db; $section = $db->selectObject('section', 'id=' . $this->params['id']); if ($section) { section::removeLevel($section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); ...
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
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...
Base
1
foreach($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count++; } else { $exptag = new expTag($tag->id); $used_tags[$tag->id] = $exptag; $used_tags[$tag->id]->c...
Class
2
public function specialLogin( $error = null ) { $request = $this->getRequest(); $out = $this->getOutput(); $out->setPageTitle( wfMessage('soa2-login-title')->escaped() ); if ($error) { $this->error($error); } else if ( $request->wasPosted() && $request->getCheck( 'username' ) ) { $username = $requ...
Base
1
$output = sprintf( '<form action="%s" method="get">%s (%s): <input type="text" name="amount" value="%s"><br />%s<br /><textarea name="stripenote" cols="80" rows="2"></textarea><br /><input type="hidden" name="txid" value="%s"><button class="stripebutton">%s</button>%s</form>', $url, __( 'Amount', 'rsvpmaker' ), esc_a...
Base
1
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
Base
1
public function generateMessageFileName() { $time = microtime(true); return date('Ymd-His-', $time) . sprintf('%04d', (int) (($time - (int) $time) * 10000)) . '-' . sprintf('%04d', mt_rand(0, 10000)) . '.eml'; }
Class
2
public function settings() { AuthUser::load(); if (!AuthUser::isLoggedIn()) { redirect(get_url('login')); } else if (!AuthUser::hasPermission('admin_edit')) { Flash::set('error', __('You do not have permission to access the requested page!')); redirect(get...
Class
2
public function Delete() { // Delete "main" ticket $del_stmt = Database::prepare(' DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = :tid' ); Database::pexecute($del_stmt, array('tid' => $this->tid)); // Delete "answers" to ticket" $del_stmt = Database::prepare(' DELETE FROM `' . TABLE_PANEL_T...
Class
2
function delete_option_master() { global $db; $masteroption = new option_master($this->params['id']); // delete any implementations of this option master $db->delete('option', 'option_master_id='.$masteroption->id); $masteroption->delete('optiongroup_master_id=' . $...
Class
2
public function getDisplayName ($plural=true) { return Yii::t('workflow', '{process}', array( '{process}' => Modules::displayName($plural, 'Process'), )); }
Base
1
function execute( $par ) { $request = $this->getRequest(); $output = $this->getOutput(); $language = $this->getLanguage(); $output->setPageTitle( $this->msg( "confirmaccounts" )->escaped() ); $output->addModules('ext.scratchConfirmAccount.js'); $output->addModuleStyles('ext.scratchConfirmAccount.cs...
Compound
4
public static function load_element_strings($node_type, $node_id, $savedOn="latest") { global $DB; // load all webdictionary history elements and keep only the latest $DB->query(' SELECT subtype, lang, text FROM nv_webdictionary_history WHERE node_type = '.protect($node_type).' AND...
Base
1
$dt = date('Y-m-d', strtotime($match)); $sql = par_rep("/'$match'/", "'$dt'", $sql); } } if (substr($sql, 0, 6) == "BEGIN;") { $array = explode(";", $sql); foreach ($array as $value) { if ($value != "") { $user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']); if ($user_...
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 get($key, $default = null, $deep = false) { if ($deep) { @trigger_error('Using paths to find deeper items in '.__METHOD__.' is deprecated since version 2.8 and will be removed in 3.0. Filter the returned value in your own code instead.', E_USER_DEPRECATED); } ...
Base
1
foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ...
Base
1
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
static function isSearchable() { return true; }
Base
1
function execute( $par ) { $this->setHeaders(); $this->outputHeader(); $pager = new GlobalNewFilesPager(); $this->getOutput()->addParserOutputContent( $pager->getFullOutput() ); }
Class
2
function getTextColumns($table) { $sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'"; $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $records = array(); while($row = mysqli_fetch_object($res)) { $records[] = $ro...
Class
2
function db_case($array) { global $DatabaseType; $counter = 0; if ($DatabaseType == 'mysqli') { $array_count = count($array); $string = " CASE WHEN $array[0] ="; $counter++; $arr_count = count($array); for ($i = 1; $i < $arr_count; $i++) { $value = $array...
Base
1
public function __construct() { }
Base
1
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
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
protected function _add_comment_log( $id, $action, $comment = null ) { if ( is_null( $comment ) ) $comment = get_comment( $id ); aal_insert_log( array( 'action' => $action, 'object_type' => 'Comments', 'object_subtype' => get_post_type( $comment->comment_post_ID ), 'object_name' => ...
Base
1
public static function hasChildren($i) { global $sections; if (($i + 1) >= count($sections)) return false; return ($sections[$i]->depth < $sections[$i + 1]->depth) ? true : false; }
Base
1
protected function putFileInStorage(UploadedFile $uploadedFile) { $attachmentData = file_get_contents($uploadedFile->getRealPath()); $storage = $this->getStorage(); $basePath = 'uploads/files/' . date('Y-m-M') . '/'; $uploadFileName = Str::random(16) . '.' . $uploadedFile->getC...
Base
1
$message = getlocal( "Operator {0} joined the chat", array($operator_name), $this->locale, true ); } elseif ($is_operator_back) {
Base
1
(empty($object_uid)? '' : ' AND node_uid = '.protect($object_uid)).' AND website = '.$website->id );
Base
1
function update_option_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $opt = new option_master($id); $oldtitle = $opt->title; $opt->update($this->params); // if the title of the master changed we should...
Class
2
public static function getFolder() { $uri = explode('/', Site::$url); if(count($uri) > 3) { unset($uri[0]); unset($uri[1]); unset($uri[2]); $uri = array_values($uri); $uris = ""; for($i=0; $i<count($uri); $i++){ ...
Base
1
$fileName = ltrim(dirname($fileName) . '/' . basename($fileName, '.js'), '/.'); if (empty($fileName)) { continue; } $templateNames[] = $inflector->filter(array( 'module' => $moduleName, 'controller' => $controllerName,...
Class
2
protected function _normpath($path) { if (empty($path)) { return '.'; } $changeSep = (DIRECTORY_SEPARATOR !== '/'); if ($changeSep) { $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); } if (strpos($path, '/') === 0) { $initial_slashes = true; } else { $initial_slashes = false; } ...
Base
1
function select_atversion(){ global $sort_versions; $menu = '<form action="'.$_SERVER['PHP_SELF'].'" method="post">'; $menu.= '<select name="atversions">'; $menu.= '<option value="0">'._AT("all").'</option>'; foreach($sort_versions as $version){ if($version == VERSION){ $menu ....
Compound
4
public function Turn() { $this->error = array("error" => "This method, TURN, of the SMTP ". "is not implemented"); if($this->do_debug >= 1) { $this->edebug("SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF . '<br />'); } return false; }
Class
2
function get_filedisplay_views() { expTemplate::get_filedisplay_views(); $paths = array( BASE.'framework/modules/common/views/file/', BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/', ); $views = array(); foreach ($paths as $path) { if (is_readable($path)) { ...
Class
2
public function __construct(){ }
Base
1
public static function upload_user_avatar() { $file = $_FILES['lp-upload-avatar']; $upload_dir = learn_press_user_profile_picture_upload_dir(); add_filter( 'upload_dir', array( __CLASS__, '_user_avatar_upload_dir' ), 10000 ); $result = wp_handle_upload( $file, array( 'test_form' => fa...
Class
2
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...
Class
2
public function getQuerySelect() { return "a.per_tracker_artifact_id AS `" . $this->name . "`"; }
Base
1
private function isWindows() { return DIRECTORY_SEPARATOR !== '/'; }
Class
2
foreach ($data['alertDanger'] as $alert) { # code... echo "<li>$alert</li>\n"; }
Base
1
public function newpassword() { if ($token = $this->param('token')) { $user = $this->app->storage->findOne('cockpit/accounts', ['_reset_token' => $token]); if (!$user) { return false; } $user['md5email'] = md5($user['email']); ...
Base
1
public function withCookieHeader(RequestInterface $request) { $values = []; $uri = $request->getUri(); $scheme = $uri->getScheme(); $host = $uri->getHost(); $path = $uri->getPath() ?: '/'; foreach ($this->cookies as $cookie) { if ($cookie->matchesPath...
Base
1
function get_filedisplay_views() { expTemplate::get_filedisplay_views(); $paths = array( BASE.'framework/modules/common/views/file/', BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/', ); $views = array(); foreach ($paths as $path) { if (is_readable($path)) { ...
Class
2
protected function _fopen($path, $mode='rb') { // try ftp stream wrapper if ($this->options['mode'] == 'passive' && ini_get('allow_url_fopen')) { $url = 'ftp://'.$this->options['user'].':'.$this->options['pass'].'@'.$this->options['host'].':'.$this->options['port'].$path; if (strtolower($mode[0]) === 'w') { ...
Base
1
public function Load($tree) { if (!$tree) return; $contents = array(); $treePath = $tree->GetPath(); $args = array(); $args[] = '--full-name'; if ($this->exe->CanShowSizeInTree()) $args[] = '-l'; $args[] = '-t'; $args[] = $tree->GetHash(); $lines = explode("\n", $this->exe->Execute($tree...
Base
1
private function _modifiedby( $option ) { $this->addTable( 'revision_actor_temp', 'change_rev' ); $user = new \User; $this->addWhere( $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' = change_rev.revactor_actor AND change_rev.revactor_page = page_id' ); }
Class
2
public function resetKey(){ $login_user = $this->checkLogin(); $item_id = I("item_id/d"); $item = D("Item")->where("item_id = '$item_id' ")->find(); if(!$this->checkItemManage($login_user['uid'] , $item['item_id'])){ $this->sendError(10303); return ; ...
Compound
4
public function testDeleteCommentAction() { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $this->assertAccessIsGranted($client, '/admin/project/1/details'); $form = $client->getCrawler()->filter('form[name=project_comment_form]')->form(); $client->submit($form...
Compound
4
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); ...
Base
1
public function gc($force = false, $expiredOnly = true) { if ($force || mt_rand(0, 1000000) < $this->gcProbability) { $this->gcRecursive($this->cachePath, $expiredOnly); } }
Class
2
public function get($extramediatypes = false) { try { return $this->getConfig($extramediatypes); } catch (\Exception $exception) { return $this->jsonError($exception); } }
Base
1
public function checkLdapLogin($username ,$password ){ $ldap_open = D("Options")->get("ldap_open" ) ; $ldap_form = D("Options")->get("ldap_form" ) ; $ldap_form = json_decode($ldap_form,1); if (!$ldap_open) { return false; } if (...
Base
1
public function testEncodeFormulasWithSettingsPassedInContext() { $this->assertSame(<<<'CSV' 0 " =2+3" CSV , $this->encoder->encode(['=2+3'], 'csv', [ CsvEncoder::ESCAPE_FORMULAS_KEY => true, ])); $this->assertSame(<<<'CSV' 0 " -2+3" CSV , $...
Base
1
public function updateFile(Attachment $attachment, $requestData) { $attachment->name = $requestData['name']; if (isset($requestData['link']) && trim($requestData['link']) !== '') { $attachment->path = $requestData['link']; if (!$attachment->external) { $th...
Base
1
private function load($id) { try { $select = $this->zdb->select(self::TABLE); $select->limit(1)->where(self::PK . ' = ' . $id); $results = $this->zdb->execute($select); $res = $results->current(); $this->id = $id; $this->name = $r...
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')....
Base
1
public function getQueryGroupby() { //Last update date is stored in the changeset (the date of the changeset) return 'c.submitted_on'; }
Base
1
public function load_by_profile($network, $network_user_id) { global $DB; global $session; // the profile exists (connected to a social network)? $swuser = $DB->query_single( 'webuser', 'nv_webuser_profiles', ' network = '.protect($ne...
Base
1
function send_reset_confirmation_request($name) { global $sitename; $rs = safe_row("email, nonce", 'txp_users', "name = '".doSlash($name)."'"); if ($rs) { extract($rs); $confirm = bin2hex(pack('H*', substr(md5($nonce), 0, 10)).$name); $message = gTxt('greeting').' '.$name.','. ...
Base
1
private function _qualitypages( $option ) { if ( function_exists( 'efLoadFlaggedRevs' ) ) { //Do not add this again if 'stablepages' has already added it. if ( !$this->parametersProcessed['stablepages'] ) { $this->addJoin( 'flaggedpages', [ "LEFT JOIN", "page_id = fp_page_id" ] ...
Class
2
public function Hello($host = '') { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Hello() without being connected"); return false; } // if hostname for HELO was not specified send default if(empty($hos...
Class
2
$user = db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($check['user']), 'username'); form_alternate_row('line' . $check['id']); $name = get_data_source_title($check['datasource']); $title = $name; if (strlen($name) > 50) { $name = substr($name, 0, 50); } form_select...
Base
1
public function chmod() { if (!AuthUser::hasPermission('file_manager_chmod')) { Flash::set('error', __('You do not have sufficient permissions to change the permissions on a file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks ...
Class
2
public function limit($value) { if ($value >= 0) { $this->limit = $value; } return $this; }
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://' . erLhcoreClassIns...
Class
2
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 __construct( Parameters $parameters ) { $this->parameters = $parameters; $this->tableNames = self::getTableNames(); $this->DB = wfGetDB( DB_REPLICA, 'dpl' ); }
Class
2
public function whereFileName($fileName) { $this->selectSingle = $this->model->getFileNameParts($fileName); return $this; }
Base
1
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
Base
1
public function display_sdm_other_details_meta_box($post) { //Other details metabox $file_size = get_post_meta($post->ID, 'sdm_item_file_size', true); $file_size = isset($file_size) ? $file_size : ''; $version = get_post_meta($post->ID, 'sdm_item_version', true); $version = isset($version) ? $version : ''; e...
Base
1
}elseif ($k == 'lang') { self::incFront('default'); }elseif($k == "error"){
Base
1
foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;')); if (!empty($multiday_event)) { ...
Base
1
public function getHeaders() { return $this->headerLines; }
Base
1
public function show($image_name) { $imageFile = storage_path('app/'.str_replace("-","/",$image_name)); if(!is_file($imageFile)){ abort(404); } $image = Image::make($imageFile); if(config('tipask.upload.open_watermark') && $image_name != config('tipask.up...
Base
1
public function testXssExternalLinkImg() { $antiXss = new \MicroweberPackages\Helper\HTMLClean(); $string = '<img src="'.site_url().'test.jpg" />'; $content = $antiXss->clean($string); $this->assertEquals('<img src="'.site_url().'test.jpg" alt="test.jpg" />', $content); ...
Base
1
public function getAlnum($key, $default = '', $deep = false) { return preg_replace('/[^[:alnum:]]/', '', $this->get($key, $default, $deep)); }
Base
1
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
Class
2
private function edebug($str) { if ($this->Debugoutput == "error_log") { error_log($str); } else { echo $str; } }
Class
2
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
function setParameter($a_name, $a_value) { $this->parameters[$a_name] = $a_value; }
Base
1
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getA...
Base
1
private function addServiceInstance($id, Definition $definition, $isSimpleInstance) { $class = $this->dumpValue($definition->getClass()); if (0 === strpos($class, "'") && false === strpos($class, '$') && !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\...
Base
1
public function testClientIpIsAlwaysLocalhostForForwardedRequests() { $this->setNextResponse(); $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); $this->assertEquals('127.0.0.1', $this->kernel->getBackendRequest()->server->get('REMOTE_ADDR')); }
Class
2
public function load_template() { global $DB; global $website; $template = new template(); if( $this->association == 'free' || ($this->association == 'category' && $this->embedding == '0')) { $template->load($this->template); } else { $category_template = $DB->query_sing...
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
$contents = ['form' => tep_draw_form('zones', 'zones.php', 'page=' . $_GET['page'] . '&action=insert')];
Base
1
public function deleteCommentAction(ProjectComment $comment) { $projectId = $comment->getProject()->getId(); try { $this->repository->deleteComment($comment); } catch (\Exception $ex) { $this->flashDeleteException($ex); } return $this->redirectTo...
Compound
4
public function getSection() { global $db; if (expTheme::inAction()) { if (isset($_REQUEST['section'])) { $section = $this->url_style=="sef" ? $this->getPageByName($_REQUEST['section'])->id : intval($_REQUEST['section']) ; } else { $section = ...
Base
1
public static function generated(){ $end_time = microtime(TRUE); $time_taken = $end_time - $GLOBALS['start_time']; $time_taken = round($time_taken,5); echo '<center><small>Page generated in '.$time_taken.' seconds.</small></center>'; }
Base
1
public function setSectionSeparators( ?array $separators ) { $this->sectionSeparators = (array)$separators ?? []; }
Class
2
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
$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 getCast($id){ $url = "http://api.themoviedb.org/3/movie/{$id}/credits?api_key=".$this->apikey; $cast = $this->curl($url); return $cast; }
Base
1
public function addJoin( $tableAlias, $joinConditions ) { if ( empty( $tableAlias ) || empty( $joinConditions ) ) { throw new \MWException( __METHOD__ . ': An empty join clause was passed.' ); } if ( isset( $this->join[$tableAlias] ) ) { throw new \MWException( __METHOD__ . ': Attempted to overwrite existi...
Class
2