code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
function updateBasicSettings(PDFStructure &$structure) { // set headline if (isset($_POST['headline'])) { $structure->setTitle(str_replace('<', '', str_replace('>', '', $_POST['headline']))); } // set logo if (isset($_POST['logoFile'])) { $structure->setLogo($_POST['logoFile']); } // set folding marks if (i...
Base
1
public function approve_submit() { global $history; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); $lastUrl = expHistory::getLast('editable'); } /* The global constants can be overriden by passi...
Base
1
public function onRouteShutdown(Enlight_Controller_EventArgs $args) { $request = $args->getRequest(); $response = $args->getResponse(); if (Shopware()->Container()->initialized('shop')) { /** @var DetachedShop $shop */ $shop = $this->get('shop'); if ...
Base
1
protected function checkTrustedHostPattern() { if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] === GeneralUtility::ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL) { $this->messageQueue->enqueue(new FlashMessage( 'Trusted hosts pattern is configured to allow all header valu...
Class
2
public function createDatabase($dbname = null) { Database::query("CREATE DATABASE `" . $dbname . "`"); }
Base
1
public function showall() { expHistory::set('viewable', $this->params); $hv = new help_version(); //$current_version = $hv->find('first', 'is_current=1'); $ref_version = $hv->find('first', 'version=\''.$this->help_version.'\''); // pagination parameter..hard coded for now. $where = ...
Base
1
$parameter = strtolower( $parameter ); //Force lower case for ease of use. if ( empty( $parameter ) || substr( $parameter, 0, 1 ) == '#' || ( $this->parameters->exists( $parameter ) && !$this->parameters->testRichness( $parameter ) ) ) { continue; } if ( !$this->parameters->exists( $parameter ) ) { ...
Class
2
public function getFilesInFolder(Folder $folder, $start = 0, $maxNumberOfItems = 0, $useFilters = true, $recursive = false, $sort = '', $sortRev = false) { $this->assureFolderReadPermission($folder); $rows = $this->getFileIndexRepository()->findByFolder($folder); $filters = $useFilters...
Base
1
foreach ($criteria as $criterion) { // recursive call if (isset($criterion['criteria'])) { return $check_criteria($criterion['criteria']); } if (!isset($criterion['field']) || !isset($criterion['searchtype']) |...
Base
1
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$str); $str = str_replace("&quot;",'"',$str); $str = str_replace("&#39;","'",$str); ...
Base
1
$rndString = function ($len = 10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $randomString = ''; for ($i = 0; $i < $len; $i++) { $randomString .= $characters[rand(0, strlen($characters) - 1)]; } r...
Class
2
public function event() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id'])) { return $this->create(); } return $this->response->html($this->template->render('action_creat...
Class
2
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...
Base
1
public function setCallback($callback) { if (!is_callable($callback)) { throw new \LogicException('The Response callback must be a valid PHP callable.'); } $this->callback = $callback; }
Base
1
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
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 function confirm() { $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, 'filt...
Base
1
public static function update($vars){ if(is_array($vars)){ $sql = array( 'table' => 'menus', 'id' => $vars['id'], 'key' => $vars['key'] ); $menu = Db::update($sql); } }...
Base
1
public function getQueryGroupby() { $R1 = 'R1_' . $this->id; $R2 = 'R2_' . $this->id; return "$R2.value"; }
Base
1
public function downloadfile() { if (empty($this->params['fileid'])) { flash('error', gt('There was an error while trying to download your file. No File Specified.')); expHistory::back(); } $fd = new filedownload($this->params['fileid']); if (empty(...
Class
2
public function getQueryOrderby() { return $this->name; }
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
static function displayname() { return gt("e-Commerce Category Manager"); }
Base
1
public static function getHelpVersionId($version) { global $db; return $db->selectValue('help_version', 'id', 'version="'.$version.'"'); }
Class
2
public function getQueryGroupby() { $R = 'R_' . $this->id; return "$R.value_id"; }
Base
1
function ac_sigleid($name, $id) { global $cms_db, $sess; $sess->gc( true ); $ret = true; if( $id >= 1 ) { $ret = false; $cquery = sprintf("select count(*) from %s where user_id='%s' and name='%s'", $cms_db['sessions'], $id, ...
Base
1
$this->_writeBackup($tmpDir . 'plugin' . DS, $plugin['Plugin']['name'], $encoding); } } // ZIP圧縮して出力 $fileName = 'baserbackup_' . $version . '_' . date('Ymd_His'); $Simplezip = new Simplezip(); $Simplezip->addFolder($tmpDir); $Simplezip->download($fileName); $this->_resetTmpSchemaFolder(); exit()...
Base
1
public static function get_param($key = NULL) { $info = [ 'stype' => htmlentities(self::$search_type), 'stext' => htmlentities(self::$search_text), 'method' => htmlentities(self::$search_method), 'datelimit' => self::$search_date_limit, ...
Compound
4
foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; }
Class
2
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 rules() { $rules = [ // 'title' => 'required', // todo with multilanguage ]; return $rules; }
Base
1
public function setContainer($container) { $this->container = $container; $container->setType('ctLinks'); }
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()...
Class
2
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...
Class
2
public function column_title( $post ) { list( $mime ) = explode( '/', $post->post_mime_type ); $title = _draft_or_post_title(); $thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) ); $link_start = $link_end = ''; if ( current_user_can( 'edit_post', $post->ID ) && ! $thi...
Base
1
public static function getSubcategories( $categoryName, $depth = 1 ) { $DB = wfGetDB( DB_REPLICA, 'dpl' ); if ( $depth > 2 ) { //Hard constrain depth because lots of recursion is bad. $depth = 2; } $categories = []; $result = $DB->select( [ 'page', 'categorylinks' ], [ 'page_title' ], [ '...
Class
2
$q = self::$mysqli->query($vars) ; if($q === false) { user_error("Query failed: ".self::$mysqli->error."<br />\n$vars"); return false; } } return $q; }
Base
1
function get_allowed_files_extensions_for_upload($fileTypes = 'images') { $are_allowed = ''; switch ($fileTypes) { case 'img': case 'image': case 'images': $are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg'; break; c...
Base
1
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) { if ( -1 == $action ) { _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' ); } $adminurl = strtolower( admin_url() ); $referer = strtolower( wp_get_referer() ...
Base
1
public function showall() { expHistory::set('viewable', $this->params); $hv = new help_version(); //$current_version = $hv->find('first', 'is_current=1'); $ref_version = $hv->find('first', 'version=\''.$this->help_version.'\''); // pagination parameter..hard coded for now. $where = ...
Base
1
private function sendString ($string) { $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); return $bytes_sent; }
Class
2
public static function go($input, $path, $allowed='', $uniq=false, $size='', $width = '', $height = ''){ $filename = Typo::cleanX($_FILES[$input]['name']); $filename = str_replace(' ', '_', $filename); if(isset($_FILES[$input]) && $_FILES[$input]['error'] == 0){ if($uniq == t...
Base
1
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
Base
1
public function archive(){ $login_user = $this->checkLogin(); $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'])){ $this->sendError(...
Compound
4
public function request($method, $uri = null, array $options = []) { $options[RequestOptions::SYNCHRONOUS] = true; return $this->requestAsync($method, $uri, $options)->wait(); }
Base
1
function can_process() { $Auth_Result = hook_authenticate($_SESSION['wa_current_user']->username, $_POST['cur_password']); if (!isset($Auth_Result)) // if not used external login: standard method $Auth_Result = get_user_auth($_SESSION['wa_current_user']->username, md5($_POST['cur_password'])); if (!$Auth_Result...
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 display_error_block() { if (!empty($_SESSION['error_msg'])) { echo ' <div> <script type="text/javascript"> $(function() { $( "#dialog:ui-dialog" ).dialog( "destroy" ); $( "#dialog-message" ).dialog({ ...
Compound
4
public function downloadfile() { if (empty($this->params['fileid'])) { flash('error', gt('There was an error while trying to download your file. No File Specified.')); expHistory::back(); } $fd = new filedownload($this->params['fileid']); if (empty(...
Base
1
protected function _archive($dir, $files, $name, $arc) { // get current directory $cwd = getcwd(); $tmpDir = $this->tempDir(); if (!$tmpDir) { return false; } //download data if (!$this->ftp_download_files($dir, $files, $tmpDir)) { //cleanup $this->rmdirRecursive($tmpDir); return false; ...
Base
1
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
Base
1
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ;
Base
1
static function encrypt($string, $key) { $result = ''; for ($i=0; $i<strlen($string); $i++) { $char = substr($string, $i, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)+ord($keychar)); $result .= $char; } return base64_...
Class
2
static function validUTF($string) { if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { return false; } return true; }
Class
2
function _makeMpName($value) { if ($value != '') { $get_name = DBGet(DBQuery('SELECT TITLE FROM marking_periods WHERE marking_period_id=' . $value)); return $get_name[1]['TITLE']; } else return ''._customCoursePeriod.''; }
Base
1
foreach ($fields as $field) { $fieldName = $field->fieldName; if ($field->type == 'date' || $field->type == 'dateTime') { if (is_numeric($record->$fieldName)) $record->$fieldName = Formatter::formatLongDateTime($record->$fieldName);...
Base
1
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'"); } if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records); // eDebug($sql, true); // count the ...
Class
2
public function getModel() { return $this->model; }
Base
1
public function setModelAttributes(&$model,&$attributeList,&$params) { $data = array (); foreach($attributeList as &$attr) { if(!isset($attr['name'],$attr['value'])) continue; if(null !== $field = $model->getField($attr['name'])) { // first do...
Class
2
function XMLRPCremoveImageGroupFromComputerGroup($imageGroup, $computerGroup){ $imageid = getResourceGroupID("image/$imageGroup"); $compid = getResourceGroupID("computer/$computerGroup"); if($imageid && $compid){ $tmp = getUserResources(array("imageAdmin"), array("man...
Class
2
public function downloadfile() { if (empty($this->params['fileid'])) { flash('error', gt('There was an error while trying to download your file. No File Specified.')); expHistory::back(); } $fd = new filedownload($this->params['fileid']); if (empty(...
Base
1
public function destroy(Appointment $appointment) { if (!auth()->user()->can("appointment-create")) { return response("Access denied", 403); } $deleted = $appointment->delete(); if ($deleted) { return response("Success"); } return response...
Class
2
function selectObjectBySql($sql) { //$logFile = "C:\\xampp\\htdocs\\supserg\\tmp\\queryLog.txt"; //$lfh = fopen($logFile, 'a'); //fwrite($lfh, $sql . "\n"); //fclose($lfh); $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($re...
Class
2
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
public function redirect($route, $code = null) { /** @var Uri $uri */ $uri = $this['uri']; //Check for code in route $regex = '/.*(\[(30[1-7])\])$/'; preg_match($regex, $route, $matches); if ($matches) { $route = str_replace($matches[1], '', $matches[...
Base
1
public function enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully...
Base
1
public function testVeryLongHosts($host) { $start = microtime(true); $request = Request::create('/'); $request->headers->set('host', $host); $this->assertEquals($host, $request->getHost()); $this->assertLessThan(3, microtime(true) - $start); }
Base
1
public function testAuthCheckDecryptPassword() { $GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey'; $GLOBALS['server'] = 1; $_REQUEST['old_usr'] = ''; $_REQUEST['pma_username'] = ''; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = ...
Class
2
public static function versionCheck() { $v = trim(self::latestVersion()); // print_r($v); if ($v > self::$version) { Hooks::attach("admin_page_notif_action", array('System', 'versionReport')); } }
Base
1
protected function _joinPath($dir, $name) { $sql = 'SELECT id FROM '.$this->tbf.' WHERE parent_id="'.$dir.'" AND name="'.$this->db->real_escape_string($name).'"'; if (($res = $this->query($sql)) && ($r = $res->fetch_assoc())) { $this->updateCache($r['id'], $this->_stat($r['id'])); return $r['id']; } ret...
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 function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
Base
1
function update_license_status() { $status = ''; $license_key = $this->get_license_key(); if (!empty($license_key) || defined('W3TC_LICENSE_CHECK')) { $license = edd_w3edge_w3tc_check_license($license_key, W3TC_VERSION); $version = ''; if ($license) { ...
Compound
4
function load_gallery($auc_id) { $UPLOADED_PICTURES = array(); if (is_dir(UPLOAD_PATH . $auc_id)) { if ($dir = opendir(UPLOAD_PATH . $auc_id)) { while ($file = @readdir($dir)) { if ($file != '.' && $file != '..' && strpos($file, 'thumb-') === false) { $UPL...
Base
1
function addDiscountToCart() { // global $user, $order; global $order; //lookup discount to see if it's real and valid, and not already in our cart //this will change once we allow more than one coupon code $discount = new discounts(); $discount = $discount->getCoupon...
Class
2
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webuser_votes WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); retur...
Base
1
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "addresses as a "; //R J...
Base
1
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); break; } // Error code for ...
Base
1
public static function filter() { //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
$section = new section($this->params); } else { notfoundController::handle_not_found(); exit; } if (!empty($section->id)) { $check_id = $section->id; } else { $check_id = $section->parent; } if (expPer...
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...
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
function yourls_create_nonce( $action, $user = false ) { if( false == $user ) $user = defined( 'YOURLS_USER' ) ? YOURLS_USER : '-1'; $tick = yourls_tick(); $nonce = substr( yourls_salt($tick . $action . $user), 0, 10 ); // Allow plugins to alter the nonce return yourls_apply_filter( 'create_nonce', $nonce, $acti...
Compound
4
public static function header($vars=""){ header("Cache-Control: must-revalidate,max-age=300,s-maxage=900"); $offset = 60 * 60 * 24 * 3; $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; header($ExpStr); header("Content-Type: text/html; charset=...
Base
1
public function showUnpublished() { expHistory::set('viewable', $this->params); // setup the where clause for looking up records. $where = parent::aggregateWhereClause(); $where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where; ...
Base
1
function update() { global $db, $user; $this->params['id'] = $db->selectValue('content_expRatings','expratings_id',"content_id='".$this->params['content_id']."' AND content_type='".$this->params['content_type']."' AND subtype='".$this->params['subtype']."' AND poster='".$user->id."'"); ...
Base
1
public function __construct() { global $wgRequest; $this->DB = wfGetDB( DB_REPLICA, 'dpl' ); $this->parameters = new Parameters(); $this->logger = new Logger( $this->parameters->getData( 'debug' )['default'] ); $this->tableNames = Query::getTableNames(); $this->wgRequest = $wgRequest; }
Class
2
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 ...
Class
2
} elseif (!is_numeric($item) && ($item != '')) { return false; } } } else { return false; } } else {
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...
Base
1
public function testSetCallbackNonCallable() { $response = new StreamedResponse(null); $response->setCallback(null); }
Base
1
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $m...
Base
1
public function testIpAddressOfRangedTrustedProxyIsSetAsRemote() { $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $expectedSubRequest->server->set('REMOTE_ADDR', '1.1.1.1'); $expectedSubRequest->headers->set...
Class
2
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
Base
1
static function isSearchable() { return true; }
Class
2
static function isSearchable() { return true; }
Base
1
protected function _filePutContents($path, $content) { $res = false; if ($local = $this->getTempFile($path)) { if (@file_put_contents($local, $content, LOCK_EX) !== false && ($fp = @fopen($local, 'rb'))) { clearstatcache(); $res = $this->_save($fp, $path, '', array()); @fclose($fp); } file...
Base
1
protected function defaultExtensions() { return [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'svg', 'js', 'map', 'ico', 'css', 'less', 'scss', ...
Base
1
$count += $db->dropTable($basename); } flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.'); expHistory::back(); }
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