code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
Base
1
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 approve_submit() { if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); expHistory::back(); } /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the...
Base
1
$query->whereExists(function ($permissionQuery) use (&$tableDetails, $action) { /** @var Builder $permissionQuery */ $permissionQuery->select(['role_id'])->from('joint_permissions') ->whereColumn('joint_permissions.entity_id', '=', $tableDetails['tableName...
Class
2
public function checkout($name) { $this->run('checkout', $name); return $this; }
Class
2
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Base
1
public function updateTab($id, $array) { if (!$id || $id == '') { $this->setAPIResponse('error', 'id was not set', 422); return null; } if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $tabInfo = $this->getTabById($id); if ($tabInfo) { $array = $this->c...
Base
1
public static function activate($mod){ $json = Options::v('modules'); $mods = json_decode($json, true); //print_r($mods); if (!is_array($mods) || $mods == "") { $mods = array(); } if (!in_array($mod, $mods)) { # code... $mo...
Base
1
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...
Base
1
foreach ($cf_d as $cfd_i => $cfd_d) { if ($cfd_i == 'TYPE') { $fc = substr($cfd_d, 0, 1); $lc = substr($cfd_d, 1); $cfd_d = strtoupper($fc) . $lc; $get_schools_cf[$cf_i][$cfd_i] = $cfd_d; unset($fc); unse...
Base
1
private function get_submit_action() { $action = null; if ( isset( $_POST['geo_mashup_add_location'] ) or isset( $_POST['geo_mashup_update_location'] ) ) { // Clients without javascript may need server side geocoding if ( ! empty( $_POST['geo_mashup_search'] ) and isset( $_POST['geo_mashup_no_js'] ...
Class
2
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 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 static function endReset( &$parser, $text ) { if ( !self::$createdLinks['resetdone'] ) { self::$createdLinks['resetdone'] = true; foreach ( $parser->getOutput()->mCategories as $key => $val ) { if ( array_key_exists( $key, self::$fixedCategories ) ) { self::$fixedCategories[$key] = $val; } ...
Class
2
protected function make($path, $name, $mime) { $sql = 'INSERT INTO %s (`parent_id`, `name`, `size`, `mtime`, `mime`, `content`, `read`, `write`) VALUES ("%s", "%s", 0, %d, "%s", "", "%d", "%d")'; $sql = sprintf($sql, $this->tbf, $path, $this->db->real_escape_string($name), time(), $mime, $this->defaults['read'], $...
Base
1
public function display_sdm_upload_meta_box($post) { // File Upload metabox $old_upload = get_post_meta($post->ID, 'sdm_upload', true); $old_value = isset($old_upload) ? $old_upload : ''; _e('Manually enter a valid URL of the file in the text box below, or click "Select File" button to upload (or choose) the d...
Base
1
foreach ($value as $i => $j) { $column_check = explode('_', $i); if ($column_check[0] == 'CUSTOM') { $check_validity = DBGet(DBQuery('SELECT COUNT(*) as REC_EX FROM school_custom_fields WHERE ID=' . $column_check[1] . ' AND (SCHOOL_ID=' ....
Base
1
static function description() { return "Manage events and schedules, and optionally publish them."; }
Class
2
echo '</SCHOOL_' . htmlentities($i) . '>'; $i++; } echo '</SCHOOL_ACCESS>'; // } echo '</STAFF_' . htmlentities($j) . '>'; $j++; }
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"); ...
Base
1
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) { $this->catch = $catch; $this->backendRequest = $request; return parent::handle($request, $type, $catch); }
Class
2
public function update(CurrencyFormRequest $request, TransactionCurrency $currency) { /** @var User $user */ $user = auth()->user(); $data = $request->getCurrencyData(); if (false === $data['enabled'] && $this->repository->currencyInUse($currency)) { $data['enabled']...
Compound
4
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
$chrootPath = realpath($chrootPath); if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) { $chrootValid = true; break; } } if ($chrootValid !== true) { throw new Exception("Perm...
Base
1
private function _titlegt( $option ) { $where = '('; if ( substr( $option, 0, 2 ) == '=_' ) { if ( $this->parameters->getParameter( 'openreferences' ) ) { $where .= 'pl_title >= ' . $this->DB->addQuotes( substr( $sTitleGE, 2 ) ); } else { $where .= $this->tableNames['page'] . '.page_title >= ' . $thi...
Class
2
public function fixsessions() { global $db; // $test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket'); $fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket'); flash('message', gt('Sessions Table was Repaired')); expHistory::back(); }
Base
1
public function matchesPath($requestPath) { $cookiePath = $this->getPath(); // Match on exact matches or when path is the default empty "/" if ($cookiePath == '/' || $cookiePath == $requestPath) { return true; } // Ensure that the cookie-path is a prefix of ...
Base
1
public static function insert ($vars) { if(is_array($vars)){ $set = ""; $k = ""; foreach ($vars['key'] as $key => $val) { $set .= "'$val',"; $k .= "`$key`,"; } $set = substr($set, 0,-1); $k =...
Compound
4
protected function deleteFileInStorage(Attachment $attachment) { $storage = $this->getStorage(); $dirPath = dirname($attachment->path); $storage->delete($attachment->path); if (count($storage->allFiles($dirPath)) === 0) { $storage->deleteDirectory($dirPath); ...
Base
1
} elseif (!is_numeric($item) && ($item != '')) { return false; } } } else { return false; } } else {
Base
1
public function printerFriendlyLink($link_text="Printer Friendly", $class=null, $width=800, $height=600, $view='', $title_text = "Printer Friendly") { $url = ''; if (PRINTER_FRIENDLY != 1 && EXPORT_AS_PDF != 1) { $class = !empty($class) ? $class : 'printer-friendly-link'; $ur...
Base
1
$text .= varset($val['helpText']) ? "<div class='field-help'>".$val['helpText']."</div>" : ""; $text .= "</td>\n</tr>\n"; } $text .="<tr> <td>".EPL_ADLAN_59."</td> <td>{$del_text} <div class='field-help'>".EPL_ADLAN_60."</div> </td> </tr> </table> <div class='buttons-bar center'>"; ...
Compound
4
$extraFields[] = ['field' => $rule->field, 'id' => $field_option['id']];
Base
1
public function withStatus($code, $reasonPhrase = '') { $new = clone $this; $new->statusCode = (int) $code; if (!$reasonPhrase && isset(self::$phrases[$new->statusCode])) { $reasonPhrase = self::$phrases[$new->statusCode]; } $new->reasonPhrase = $reasonPhrase;...
Base
1
private function getDefaultConf(EasyHandle $easy) { $conf = [ '_headers' => $easy->request->getHeaders(), CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), CURLOPT_URL => (string) $easy->request->getUri(), CURLOPT_RETURNTRANSFER...
Base
1
public function Connect($host, $port = 0, $tval = 30) { // set the error val to null so there is no confusion $this->error = null; // make sure we are __not__ connected if($this->connected()) { // already connected, generate error $this->error = array("error" => "Already connected to a se...
Class
2
$modelName = ucfirst ($module->name); if (class_exists ($modelName)) { // prefix widget class name with custom module model name and a delimiter $cache[$widgetType][$modelName.'::TemplatesGridViewProfileWidget'] = ...
Class
2
public static function referenceFixtures() { return array( 'campaign' => array ('Campaign', '.CampaignMailingBehaviorTest'), 'lists' => 'X2List', 'credentials' => 'Credentials', 'users' => 'User', 'profile' => array('Profile','.marketing') ...
Base
1
$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
$db->insertObject($obj, 'expeAlerts_subscribers'); } $count = count($this->params['ealerts']); if ($count > 0) { flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.')); } else { ...
Base
1
public function elements_count() { global $DB; global $webuser; $permission = (!empty($_SESSION['APP_USER#'.APP_UNIQUE])? 1 : 0); // public access / webuser based / webuser groups based $access = 2; if(!empty($current['webuser'])) { ...
Base
1
private function edebug($str) { if ($this->Debugoutput == "error_log") { error_log($str); } else { echo $str; } }
Base
1
return $fa->nameGlyph($icons, 'icon-'); } } else { return array(); } }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webdictionary WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); retur...
Base
1
public function __construct( GlyphFinder $glyph_finder, ProjectXMLMerger $project_xml_merger, ConsistencyChecker $consistency_checker, TemplateDao $template_dao, ProjectManager $project_manager, EventDispatcherInterface $event_dispatcher, ) { $this->templa...
Class
2
public function testAddAndRemoveQueryValues() { $uri = new Uri('http://foo.com/bar'); $uri = Uri::withQueryValue($uri, 'a', 'b'); $uri = Uri::withQueryValue($uri, 'c', 'd'); $uri = Uri::withQueryValue($uri, 'e', null); $this->assertEquals('a=b&c=d&e', $uri->getQuery()); ...
Base
1
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
Base
1
public function Reset() { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Reset() without being connected"); return false; } fputs($this->smtp_conn,"RSET" . $this->CRLF); $rply = $this->get_lines(); ...
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
foreach ($events as $event) { $extevents[$date][] = $event; }
Base
1
private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level) { $source = var_export(substr($this->source, $start, $end - $start), true); $callable = $this->getCallable(); if ($otag !== '{{' || $ctag !== '}}') { $delimTag = var_export(sprintf('{{= %s ...
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
foreach ($days as $value) { $regitem[] = $value; }
Base
1
public function createComment($id, $source = "leaves/leaves"){ $this->auth->checkIfOperationIsAllowed('view_leaves'); $data = getUserContext($this); $oldComment = $this->leaves_model->getCommentsLeave($id); $newComment = new stdClass; $newComment->type = "comment"; $newComment->a...
Base
1
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
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
public function clean($html) { $antiXss = new \voku\helper\AntiXSS(); $html = $antiXss->xss_clean($html); $config = \HTMLPurifier_Config::createDefault(); if ($this->purifierPath) { $config->set('Cache.SerializerPath', $this->purifierPath); } if ($thi...
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...
Class
2
public static function validatePMAStorage($path, $values) { $result = array( 'Server_pmadb' => '', 'Servers/1/controluser' => '', 'Servers/1/controlpass' => '' ); $error = false; if ($values['Servers/1/pmadb'] == '') { return $resu...
Class
2
public function actionPublishPost() { $post = new Events; // $user = $this->loadModel($id); if (isset($_POST['text']) && $_POST['text'] != "") { $post->text = $_POST['text']; $post->visibility = $_POST['visibility']; if (isset($_POST['associationId'])) ...
Base
1
public function testRemoveAuthorizationHeaderOnRedirect() { $mock = new MockHandler([ new Response(302, ['Location' => 'http://test.com']), static function (RequestInterface $request) { self::assertFalse($request->hasHeader('Authorization')); retur...
Class
2
public function Login ($username = '', $password = '') { if ($this->connected == false) { $this->error = 'Not connected to POP3 server'; if ($this->do_debug >= 1) { $this->displayErrors(); } } if (empty($username)) { $username = $this->username; } if (empty($pass...
Class
2
public static function dplParserFunction( &$parser ) { self::setLikeIntersection( false ); $parser->addTrackingCategory( 'dpl-parserfunc-tracking-category' ); // callback for the parser function {{#dpl: or {{DynamicPageList:: $input = ""; $numargs = func_num_args(); if ( $numargs < 2 ) { $input =...
Class
2
public function testNoAuthorityWithInvalidPath() { $input = 'urn://example:animal:ferret:nose'; $uri = new Uri($input); }
Base
1
public function __construct () { }
Base
1
foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; }
Base
1
public static function html() { new Xaptcha(); $html = "<div class=\"form-group\"> <div class=\"g-recaptcha\" data-sitekey=\"".self::$key."\"></div></div> <script type=\"text/javascript\" src=\"https://www.google.com/recaptcha/api.js?hl=".self::$lang....
Base
1
$contents = ['form' => tep_draw_form('languages', 'languages.php', 'page=' . $_GET['page'] . '&lID=' . $lInfo->languages_id . '&action=save')];
Base
1
function send_feedback() { $success = false; if (isset($this->params['id'])) { $ed = new eventdate($this->params['id']); // $email_addrs = array(); if ($ed->event->feedback_email != '') { $msgtemplate = expTemplate::get_template_for_action($th...
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 ...
Base
1
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_restriction/show', array( 'status_list' => array( SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::S...
Base
1
public static function getParent($parent='', $menuid = ''){ if(isset($menuid)){ $where = " AND `menuid` = '{$menuid}'"; }else{ $where = ''; } $sql = sprintf("SELECT * FROM `menus` WHERE `parent` = '%s' %s", $parent, $where); $menu = Db::result($sql); ...
Base
1
function deleteAllCustomDNSEntries() { $handle = fopen($customDNSFile, "r"); if ($handle) { try { while (($line = fgets($handle)) !== false) { $line = str_replace("\r","", $line); $line = str_replace("\n","", $line); $explodedLine =...
Class
2
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
Base
1
public function saveLdapConfig(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $ldap_open = intval(I("ldap_open")) ; $ldap_form = I("ldap_form") ; if ($ldap_open) { if (!$ldap_form['user_field']) { $ldap_form['user_field'] = 'cn...
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
static function displayname() { return gt("e-Commerce Category Manager"); }
Base
1
private static function _aesEncrypt($data, $secret) { if (!is_string($data)) { throw new \InvalidArgumentException('Input parameter "$data" must be a string.'); } if (!function_exists("openssl_encrypt")) { throw new \SimpleSAML_Error_Exception('The openssl PHP mo...
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
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); $...
Base
1
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.m4a','.ogg','.webma','.mp4','.flv', '.mov','.webmv','.m3u8a','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso','.bz2','.epub', '.pdf','.ofd','.sw...
Base
1
public function get($id) { if (!is_numeric($id)) { $this->errors[] = _T("ID must be an integer!"); return false; } try { $select = $this->zdb->select($this->table); $select->where($this->fpk . '=' . $id); $results = $this->zdb...
Base
1
public function getSelectorsBySpecificity($sSpecificitySearch = null) { if (is_numeric($sSpecificitySearch) || is_numeric($sSpecificitySearch[0])) { $sSpecificitySearch = "== $sSpecificitySearch"; } $aResult = array(); $this->allSelectors($aResult, $sSpecificitySearch); ...
Base
1
public static function checkPermissions($permission,$location) { global $exponent_permissions_r, $router; // only applies to the 'manage' method if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($...
Base
1
$item = array(); $item['id'] = $incident->id; $item['title'] = $incident->incident_title; $item['link'] = $site_url.'reports/view/'.$incident->id; $item['description'] = $incident->incident_description; $item['date'] = $incident->incident_date; $item['categories'] = $categories; if ...
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
function preview() { if ($this->params['id'] == 0) { // we want the default editor $demo = new stdClass(); $demo->id = 0; $demo->name = "Default"; if ($this->params['editor'] == 'ckeditor') { $demo->skin = 'kama'; } elseif ($thi...
Base
1
PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['LogoutURL']); } else { PMA_sendHeaderLocation($GLOBALS['cfg']['Server']['SignonURL']); } if (!defined('TESTSUITE')) { exit(); } else { return false; } }
Class
2
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_properties WHERE website = '.protect($website->id), 'object'); if($type='json') $out['nv_properties'] = json_encode($DB->result()); ...
Base
1
protected function renderImageByImagick($code) { $backColor = $this->transparent ? new \ImagickPixel('transparent') : new \ImagickPixel('#' . str_pad(dechex($this->backColor), 6, 0, STR_PAD_LEFT)); $foreColor = new \ImagickPixel('#' . str_pad(dechex($this->foreColor), 6, 0, STR_PAD_LEFT)); ...
Class
2
public function boot() { // Configure the debugbar Config::set('debugbar', Config::get('rainlab.debugbar::config')); // Service provider App::register('\Barryvdh\Debugbar\ServiceProvider'); // Register alias $alias = AliasLoader::getInstance(); $alias->a...
Base
1
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id); if (!empty($newret)) $ret .= $newret . '<br>'; if ($iLoc->mod == 'container') { $ret .= scan_container($container->internal, $page_id); } } retu...
Class
2
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
public function testGetFilesWithBrokenSetup() { $location = ''; $features = ''; $etag = 1111222233334444; $mediatypes = 'image/png'; $exceptionMessage = 'Aïe!'; $this->searchFolderService->expects($this->once()) ->method('getCurrentFolder') ->with( $location, [$fea...
Base
1
public function setScriptSrc(Response $response) { if (config('app.allow_content_scripts')) { return; } $parts = [ 'http:', 'https:', '\'nonce-' . $this->nonce . '\'', '\'strict-dynamic\'', ]; $value = 'script-...
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 execute() { parent::execute(); // get parameters $term = SpoonFilter::getPostValue('term', null, ''); // validate if($term == '') $this->output(self::BAD_REQUEST, null, 'term-parameter is missing.'); // previous search result $previousTerm = SpoonSession::exists('searchTerm') ? SpoonS...
Base
1
public function delete($id) { if ($this->securityController->isWikiHibernated()) { throw new \Exception(_t('WIKI_IN_HIBERNATION')); } // tests of if $formId is int if (strval(intval($id)) != strval($id)) { return null ; } $this->clear($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
public function manage() { expHistory::set('manageable',$this->params); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( ...
Class
2