code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
function categoryBreadcrumb() { // global $db, $router; //eDebug($this->category); /*if(isset($router->params['action'])) { $ancestors = $this->category->pathToNode(); }else if(isset($router->params['section'])) { $current = $db->select...
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 _dimensions($path, $mime) { clearstatcache(); return strpos($mime, 'image') === 0 && ($s = @getimagesize($path)) !== false ? $s[0].'x'.$s[1] : false; }
Base
1
public function getError() { return $this->error; }
Class
2
protected function getFullPath($path, $base) { $separator = $this->separator; $systemroot = $this->systemRoot; $sepquoted = preg_quote($separator, '#'); // normalize `/../` $normreg = '#('.$sepquoted.')[^'.$sepquoted.']+'.$sepquoted.'\.\.'.$sepquoted.'#'; while(preg_match($normreg, $path)) { $path = p...
Base
1
public function getListStart() { // increase start value of ordered lists at multi-column output //The offset that comes from the URL parameter is zero based, but has to be +1'ed for display. $offset = $this->getParameters()->getParameter( 'offset' ) + 1; if ( $offset != 0 ) { //@TODO: So this adds the tot...
Class
2
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
Base
1
public function testGetDropdownConnect($params, $expected, $session_params = []) { $this->login(); $bkp_params = []; //set session params if any if (count($session_params)) { foreach ($session_params as $param => $value) { if (isset($_SESSION[$param])) { $...
Base
1
public function remove() { $project = $this->getProject(); $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { ...
Base
1
public function confirm() { $task = $this->getTask(); $link = $this->getTaskLink(); $this->response->html($this->template->render('task_internal_link/remove', array( 'link' => $link, 'task' => $task, ))); }
Class
2
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
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)) { ...
Base
1
return $fa->nameGlyph($icons, 'icon-'); } } else { return array(); } }
Class
2
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
Class
2
public function redirect($url) { if (trim($url) == '') { return false; } $url = str_ireplace('Location:', '', $url); $url = trim($url); $redirectUrl = site_url(); $parseUrl = parse_url($url); if (isset($parseUrl['host'])) { if ($p...
Base
1
public function duplicate($hash, $suffix='copy') { if ($this->commandDisabled('duplicate')) { return $this->setError(elFinder::ERROR_COPY, '#'.$hash, elFinder::ERROR_PERM_DENIED); } if (($file = $this->file($hash)) == false) { return $this->setError(elFinder::ERROR_COPY, elFinder::ERROR_FILE_NOT_FOUND);...
Base
1
public function buildControl() { $control = new colorcontrol(); if (!empty($this->params['value'])) $control->value = $this->params['value']; if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value']; $control->default = $this->params['value']; ...
Base
1
protected function _joinPath($dir, $name) { return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name; }
Base
1
foreach ($events as $event) { $extevents[$date][] = $event; }
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...
Base
1
public function buildCurrentUrl() { $url = URL_BASE; if ($this->url_style == 'sef') { $url .= substr(PATH_RELATIVE,0,-1).$this->sefPath; } else { $url .= urldecode((empty($_SERVER['REQUEST_URI'])) ? $_ENV['REQUEST_URI'] : $_SERVER['REQUEST_URI']); } r...
Base
1
public function load_from_resultset($rs) { global $DB; $main = $rs[0]; $this->id = $main->id; $this->codename = $main->codename; $this->icon = $main->icon; $this->lid = $main->lid; $this->notes = $main->notes; $this->enabled = $main->enabled; ...
Base
1
public function redeemable($cart, $webuser) { global $website; global $DB; // 1/ coupon matches the current website $redeemable = true; if($this->website != $website->id) $redeemable = false; // 2/ coupon currency matches the current cart...
Base
1
public function __construct () { }
Base
1
public function searchNew() { global $db, $user; //$this->params['query'] = str_ireplace('-','\-',$this->params['query']); $sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, "; $sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "...
Base
1
public function approve() { expHistory::set('editable', $this->params); /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['r...
Base
1
public function testSameInstanceWhenSameProtocol() { $r = new Response(200); $this->assertSame($r, $r->withProtocolVersion('1.1')); }
Base
1
private function checkDecode(array $options, array $headers, $stream) { // Automatically decode responses when instructed. if (!empty($options['decode_content'])) { $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); if (isset($normalizedKeys['content-encoding'...
Base
1
public function theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('D...
Base
1
private function decryptContentEncryptionKey($private_key_or_secret) { switch ($this->header['alg']) { case 'RSA1_5': $rsa = $this->rsa($private_key_or_secret, RSA::ENCRYPTION_PKCS1); $this->content_encryption_key = $rsa->decrypt($this->jwe_encrypted_key); ...
Class
2
private function sendString ($string) { $bytes_sent = fwrite($this->pop_conn, $string, strlen($string)); return $bytes_sent; }
Base
1
public function __construct() { $this->smtp_conn = 0; $this->error = null; $this->helo_rply = null; $this->do_debug = 0; }
Base
1
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
$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('tax_rates.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
Base
1
public function manage_messages() { expHistory::set('manageable', $this->params); $page = new expPaginator(array( 'model'=>'order_status_messages', 'where'=>1, 'limit'=>10, 'order'=>'body', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), ...
Base
1
static function getRSSFeed($url, $cache_duration = DAY_TIMESTAMP) { global $CFG_GLPI; $feed = new SimplePie(); $feed->set_cache_location(GLPI_RSS_DIR); $feed->set_cache_duration($cache_duration); // proxy support if (!empty($CFG_GLPI["proxy_name"])) { $prx_opt = []; ...
Class
2
public function __invoke(Request $request, Expense $expense) { $this->authorize('update', $expense); $data = json_decode($request->attachment_receipt); if ($data) { if ($request->type === 'edit') { $expense->clearMediaCollection('receipts'); } ...
Base
1
$date->delete(); // event automatically deleted if all assoc eventdates are deleted } expHistory::back(); }
Base
1
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
public function sdm_save_upload_meta_data($post_id) { // Save File Upload metabox if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; if (!isset($_POST['sdm_upload_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_upload_box_nonce_check'], 'sdm_upload_box_nonce')) return; if (isset($_POST['sdm_...
Base
1
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
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() ...
Compound
4
public function IsQmail() { if (stristr(ini_get('sendmail_path'), 'qmail')) { $this->Sendmail = '/var/qmail/bin/sendmail'; } $this->Mailer = 'sendmail'; }
Base
1
private function generateFakeFileData() { return [ 'name' => md5(mt_rand()), 'tmp_name' => md5(mt_rand()), 'type' => 'image/jpeg', 'size' => mt_rand(1000, 10000), 'error' => '0', ]; }
Class
2
public function testRemoveCurlAuthorizationOptionsOnRedirect($auth) { if (!defined('\CURLOPT_HTTPAUTH')) { self::markTestSkipped('ext-curl is required for this test'); } $mock = new MockHandler([ new Response(302, ['Location' => 'http://test.com']), s...
Class
2
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...
Variant
0
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 function testSetActivePhp53() { if (PHP_VERSION_ID >= 50400) { $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } $this->proxy->setActive(true); $this->assertTrue($this->proxy->isActive()); $this->proxy->setActive(false); $this->asser...
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...
Class
2
public static function botlist() { $botlist = array( "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", ...
Base
1
function advancedFilterSearch($queue, $filter) { global $database_ged; $datas = array(); if($filter == "description"){ echo json_encode($datas); return false; } $gedsql_result1=sqlrequest($database_ged,"SELECT pkt_type_id,pkt_type_name FROM pkt_type WHERE pkt_type_id!='0' AND pkt_type_id<'100';"); while...
Base
1
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
Base
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
public function __construct() { }
Base
1
$file_link = explode(" ", trim($row['file']))[0]; // If the link has no "http://" in front, then add it if (substr(strtolower($file_link), 0, 4) !== 'http') { $file_link = 'http://' . $file_link; } echo '<td><a href="htt...
Base
1
public function editAlt() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->alt = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your alt was updated succ...
Base
1
public static function sitemap() { switch (SMART_URL) { case true: # code... $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":""; $url = Site::$url.$inFold."/sitemap".GX_URL_PREFIX; break; ...
Base
1
public function create(Request $request) { /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); ...
Compound
4
protected function getTempFile($path = '') { static $cache = array(); static $rmfunc; $key = ''; if ($path !== '') { $key = $this->id . '#' . $path; if (isset($cache[$key])) { return $cache[$key]; } } if ($tmpdir = $this->getTempPath()) { if (!$rmfunc) { $rmfunc = create_function(...
Base
1
public function test_create_nonce_url() { $url = yourls_nonce_url( rand_str(), rand_str(), rand_str(), rand_str() ); $this->assertTrue( is_string($url) ); // $this->assertIsString($url); }
Compound
4
public function IsSMTP() { $this->Mailer = 'smtp'; }
Base
1
public static function fixName($name) { $name = preg_replace('/[^A-Za-z0-9\.]/','_',$name); if ($name[0] == '.') $name[0] = '_'; return $name; // return preg_replace('/[^A-Za-z0-9\.]/', '-', $name); }
Base
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
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 static function scrap($param) { if ($param != '') { foreach ($param as $k => $v) { if (is_array($v)) { foreach ($v as $k2 => $v2) { $data[$k2] = $v2; } }else{ ...
Base
1
function teampass_decrypt_pw($encrypted, $salt, $rand_key, $itcount = 2072) { $encrypted = base64_decode($encrypted); $pass_salt = substr($encrypted, -64); $encrypted = substr($encrypted, 0, -64); $key = teampass_pbkdf2_hash($salt, $pass_salt, $itcount, 16, 32); $iv = base64_decode(subs...
Base
1
function download($disposition=false, $expires=false) { $disposition = $disposition ?: 'inline'; $bk = $this->open(); if ($bk->sendRedirectUrl($disposition)) return; $ttl = ($expires) ? $expires - Misc::gmtime() : false; $this->makeCacheable($ttl); $type =...
Base
1
public function addUser(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $username = I("post.username"); $password = I("post.password"); $uid = I("post.uid"); $name = I("post.name"); if(!$username){ $this->sendError(10101,'用户名不允许为空'); ...
Base
1
private function getHttpResponseHeader($url) { if (function_exists('curl_exec')) { $c = curl_init(); curl_setopt( $c, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $c, CURLOPT_CUSTOMREQUEST, 'HEAD' ); curl_setopt( $c, CURLOPT_HEADER, 1 ); curl_setopt( $c, CURLOPT_NOBODY, true ); curl_setopt( $c, CU...
Base
1
public function getQuerySelect() { return ''; }
Base
1
static protected function getFontsizeSelection() { $current_size = $GLOBALS['PMA_Config']->get('fontsize'); // for the case when there is no config file (this is supported) if (empty($current_size)) { if (isset($_COOKIE['pma_fontsize'])) { $current_size = $_CO...
Base
1
public function addUser(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $username = I("username"); $password = I("password"); $uid = I("uid"); $name = I("name"); if(!$username){ $this->sendError(10101,'用户名不允许为空'); return ; ...
Compound
4
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...
Compound
4
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
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql); foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; retur...
Base
1
private function add_timeout(RequestInterface $request, &$options, $value, &$params) { $options['http']['timeout'] = $value; }
Base
1
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
Class
2
public function getDisplayName ($plural=true) { return Yii::t('workflow', '{process}', array( '{process}' => Modules::displayName($plural, 'Process'), )); }
Class
2
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
public function downloadFiles() { App()->loadLibrary('admin.pclzip'); $folder = basename(Yii::app()->request->getPost('folder', 'global')); $files = Yii::app()->request->getPost('files'); $tempdir = Yii::app()->getConfig('tempdir'); $randomizedFileName = $folder.'_'...
Base
1
public static function strValidCharacters($string, $checkType) { if (trim($string) === '') { return false; } switch ($checkType) { case 'noSpecialChar': // a simple e-mail address should still be possible (like username) $validRegex = '/^[\w.@+-]+...
Base
1
foreach($course_RET as $period_day) { $period_days_append_sql .="(sp.start_time<='$period_day[END_TIME]' AND '$period_day[START_TIME]'<=sp.end_time AND DAYS LIKE '%$period_day[DAYS]%') OR "; }
Base
1
protected function connect() { $user = $this->getUser(); $workgroup = null; if (strpos($user, '/')) { list($workgroup, $user) = explode('/', $user); } $this->state->init($workgroup, $user, $this->getPassword()); }
Base
1
public static function restoreX2AuthManager () { if (isset (self::$_oldAuthManagerComponent)) { Yii::app()->setComponent ('authManager', self::$_oldAuthManagerComponent); } else { throw new CException ('X2AuthManager component could not be restored'); } }
Class
2
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 testSetActivePhp54() { $this->proxy->setActive(true); }
Base
1
} elseif ($exception instanceof ErrorException) { $message = "{$exception->getName()}"; } else {
Base
1
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...
Class
2
protected function gdImage($image, $filename, $destformat, $mime, $jpgQuality = null ){ if (!$jpgQuality) { $jpgQuality = $this->options['jpgQuality']; } if ($destformat == 'jpg' || ($destformat == null && $mime == 'image/jpeg')) { return imagejpeg($image, $filename, $jpgQuality); } if ($destformat =...
Base
1
public function addMessage( $errorId ) { $args = func_get_args(); $args = array_map( 'htmlspecialchars', $args ); return call_user_func_array( [ $this, 'msg' ], $args ); }
Class
2
$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 testDestroy() { $collection = $this->createMongoCollectionMock(); $this->mongo->expects($this->once()) ->method('selectCollection') ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); ...
Base
1
private function generateFakeFileData() { return [ 'name' => md5(mt_rand()), 'tmp_name' => md5(mt_rand()), 'type' => 'image/jpeg', 'size' => mt_rand(1000, 10000), 'error' => '0', ]; }
Class
2
public static function isExist($token){ $json = Options::v('tokens'); $tokens = json_decode($json, true); if(!is_array($tokens) || $tokens == ""){ $tokens = array(); } if(array_key_exists($token, $tokens)){ $call = true; }else{ ...
Base
1
function update_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; //This will make sure that only the country or region that given a rate value will be saved in the db $upcharge = array(); foreach($this->params['upch...
Base
1
static::$functions = ['random_bytes' => false, 'openssl_random_pseudo_bytes' => false, 'mcrypt_create_iv' => false];
Class
2
public function delete() { global $db, $history; /* 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']) ? SIMPL...
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...
Base
1
public function toolbar() { // global $user; $menu = array(); $dirs = array( BASE.'framework/modules/administration/menus', BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus' ); foreach ($dirs as $dir) { if (is_readable($dir)) { $dh = opendir($dir); while (...
Base
1
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Class
2