code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
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
public function saveconfig() { global $db; if (empty($this->params['id'])) return false; $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']); $calc = new $calcname($this->params['id']); $conf = serialize($calc->parseConfig($this->...
Base
1
function selectObjectsBySql($sql) { $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $objects = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $objects[] = mysqli_fetch_object($res); return $objec...
Base
1
public function saveconfig() { global $db; if (empty($this->params['id'])) return false; $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']); $calc = new $calcname($this->params['id']); $conf = serialize($calc->parseConfig($this->...
Base
1
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
Base
1
function get_plural_forms() { // lets assume message number 0 is header // this is true, right? $this->load_tables(); // cache header field for plural forms if (! is_string($this->pluralheader)) { if ($this->enable_cache) { $header = $this->cache_translations[""]; } else { ...
Base
1
public static function footer($vars=""){ global $GLOBALS; if (isset($vars)) { # code... $GLOBALS['data'] = $vars; self::theme('footer', $vars); }else{ self::theme('footer'); } }
Base
1
public function testVersion() { $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->assertAccessIsGranted($client, '/api/version'); $result = json_decode($client->getResponse()->getContent(), true); $this->assertIsArray($result); $this->assertArrayHa...
Base
1
private function getCriterionValue($value) { if ($value instanceof \AbstractQuery) { return $value->getQuery(); } else if ($value instanceof \QueryExpression) { return $value->getValue(); } else if (DBmysql::isNameQuoted($value)) { //FIXME: database related return $value;...
Base
1
function barcode_encode($code,$encoding) { global $genbarcode_loc; if ( ((preg_match("/^ean$/i", $encoding) && ( strlen($code)==12 || strlen($code)==13))) || (($encoding) && (preg_match("/^isbn$/i", $encoding)) && (( strlen($code)==9 || strlen($code)==10) || (((preg_match("/^978/", $code) ...
Class
2
public function setMultiSectionSeparators( ?array $separators ) { $this->multiSectionSeparators = (array)$separators ?? []; }
Class
2
public function manage_sitemap() { global $db, $user, $sectionObj, $sections; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // all we need to do is determine the current section $navsections = $sections; if (...
Base
1
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
Base
1
public function handle($request, Closure $next) { view()->share('cspNonce', $this->cspService->getNonce()); if ($this->cspService->allowedIFrameHostsConfigured()) { config()->set('session.same_site', 'none'); } $response = $next($request); $this->cspService-...
Base
1
public function manage_versions() { expHistory::set('manageable', $this->params); $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); $sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h '; $sql .= 'RIGHT JOIN '.DB_TABLE_PREF...
Class
2
$confirm = pack('H*', gps('confirm')); $name = substr($confirm, 5); $nonce = safe_field("nonce", 'txp_users', "name = '".doSlash($name)."'"); if ($nonce and $confirm === pack('H*', substr(md5($nonce), 0, 10)).$name) { include_once txpath.'/lib/txplib_admin.php'; ...
Base
1
function update_vendor() { $vendor = new vendor(); $vendor->update($this->params['vendor']); expHistory::back(); }
Base
1
public function getQuerySelect() { $R = 'R_' . $this->id; return "$R.value_id AS `" . $this->name . "`"; }
Base
1
public function getViewFileParams () { if (!isset ($this->_viewFileParams)) { $this->_viewFileParams = array_merge ( parent::getViewFileParams (), array ( 'chartType' => $this->chartType, 'chartSettingsDataProvider' => self::getChart...
Class
2
public function password() { $user = Auth::user(); return view('account/change-password', compact('user')); }
Compound
4
public static function validateServer($path, $values) { $result = array( 'Server' => '', 'Servers/1/user' => '', 'Servers/1/SignonSession' => '', 'Servers/1/SignonURL' => '' ); $error = false; if ($values['Servers/1/auth_type'] == '...
Class
2
function logon($username, $password, &$sessionId) { global $_POST, $_COOKIE; global $strUsernameOrPasswordWrong; /** * @todo Please check if the following statement is in correct place because * it seems illogical that user can get session ID from internal login with ...
Compound
4
function output( $p_format = 'dot', $p_headers = false ) { # Check if it is a recognized format. if( !isset( $this->formats[$p_format] ) ) { trigger_error( ERROR_GENERIC, ERROR ); } $t_binary = $this->formats[$p_format]['binary']; $t_type = $this->formats[$p_format]['type']; $t_mime = $this->formats[$p...
Base
1
public function testPinCommentAction() { $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 edit_option_master() { expHistory::set('editable', $this->params); $params = isset($this->params['id']) ? $this->params['id'] : $this->params; $record = new option_master($params); assign_to_template(array( 'record'=>$record )); }
Class
2
public function backup($type='json') { global $DB; global $website; $DB->query('SELECT * FROM nv_shipping_methods WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return ...
Base
1
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,n...
Class
2
function __construct(Frame $frame, Dompdf $dompdf) { parent::__construct($frame, $dompdf); $url = $frame->get_node()->getAttribute("src"); $debug_png = $dompdf->getOptions()->getDebugPng(); if ($debug_png) { print '[__construct ' . $url . ']'; } list...
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 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
$_ret[$_k] = $this->convEnc($_v, $from, $to, '', false, $unknown = '_'); } $var = $_ret; } else { $_var = false; if (is_string($var)) { $_var = $var; if (false !== ($_var = @iconv($from, $to.'//TRANSLIT', $_var))) { $_var = str_replace('?', $unknown, $_var); } } if ...
Base
1
$content = ($vars['excerpt'])? substr( strip_tags( Typo::Xclean($p->content) ), 0, $excerptMax): ""; echo "<li class=\"".$liClass."\"> <h4 class=\"".$h4Class."\"><a href=\"".Url::post($p->id)."\">{...
Base
1
public function getFilePath($fileName = null) { if ($fileName === null) { $fileName = $this->fileName; } return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName; }
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...
Class
2
function sell_media_ecommerce_enabled( $post_id ) { $status = true; $meta = get_post_meta( $post_id, 'sell_media_enable_ecommerce', true ); if ( class_exists( 'VS_Platform' ) && 0 === $meta ) { $status = false; } return $status; }
Base
1
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
Base
1
public function getLatestRevisions() { if (! $this->latest_revisions) { $pm = ProjectManager::instance(); $project = $pm->getProject($this->group_id); if ($project && $this->canBeUsedByProject($project)) { list($this->latest_revisions,) = svn_get_revis...
Base
1
public function testNameExceptionPhp53() { if (PHP_VERSION_ID >= 50400) { $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } $this->proxy->setActive(true); $this->proxy->setName('foo'); }
Base
1
protected static function localScandir($dir) { // PHP function scandir() is not work well in specific environment. I dont know why. // ref. https://github.com/Studio-42/elFinder/issues/1248 $files = array(); if ($dh = opendir($dir)) { while (false !== ($file = readdir($dh))) { if ($file !== '.' && $file...
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully...
Class
2
function show_vendor () { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); $vendor_title = $vendor->title; $state = new geoRegion($vendor->state); $vendor->state = $state->name; //Removed unnecessary fields unset( ...
Class
2
public static function getModelTypes($assoc = false) { $modelTypes = Yii::app()->db->createCommand() ->selectDistinct('modelName') ->from('x2_fields') ->where('modelName!="Calendar"') ->order('modelName ASC') ->queryColumn(); ...
Base
1
$file = sprintf('%s/%s.class.php', $path, $class_name); if(is_file($file)) { include_once $file; } } }
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
function manage () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchas...
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
->first(function (User $user) { return $user->getPreference('blocksPd', false); }) !== null;
Class
2
function edit_optiongroup_master() { expHistory::set('editable', $this->params); $id = isset($this->params['id']) ? $this->params['id'] : null; $record = new optiongroup_master($id); assign_to_template(array( 'record'=>$record )); }
Base
1
public static function getHelpVersionId($version) { global $db; return $db->selectValue('help_version', 'id', 'version="'.$version.'"'); }
Class
2
form_selectable_cell(filter_value($vdef['name'], get_request_var('filter'), 'vdef.php?action=edit&id=' . $vdef['id']), $vdef['id']); form_selectable_cell($disabled ? __('No'):__('Yes'), $vdef['id'], '', 'text-align:right'); form_selectable_cell(number_format_i18n($vdef['graphs'], '-1'), $vdef...
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); }
Class
2
protected function fsock_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp) { $connect_timeout = 3; $connect_try = 3; $method = 'GET'; $readsize = 4096; $ssl = ''; $getSize = null; $headers = ''; $arr = parse_url($url); if (!$arr) ...
Base
1
public function testInfoWithoutUrl() { $this->assertRequestIsRedirect('info'); }
Base
1
public function start() { if ($this->started) { return true; } if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE === session_status()) { throw new \RuntimeException('Failed to start the session: already started by PHP.'); } if (PHP_VERSION_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 static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
Class
2
function searchName() { return gt("Calendar Event"); }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_webdictionary_history WHERE website = '.protect($website->id), 'object' ); if($type='json') $out = json_en...
Base
1
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 static function local($date, $format=''){ setlocale(LC_TIME, Options::v('country_id')); (empty($format))? $format = "%#d %B %Y %H:%M %p" : $format = $format; $timezone = Options::v('timezone'); $date = new DateTime($date); $date->setTimezone(new DateTimeZone($time...
Base
1
public static function getHelpVersionId($version) { global $db; return $db->selectValue('help_version', 'id', 'version="'.$version.'"'); }
Base
1
public function getFileContent($file, $identifier) { $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file)); $this->process->execute($resource, $content, $this->repoDir); if (!trim($content)) { return null; } ...
Base
1
public function getQueryOrderby() { return $this->getBind()->getQueryOrderby(); }
Base
1
public function getQuerySelect() { return ''; }
Base
1
public function rename($hash, $name) { if ($this->commandDisabled('rename')) { return $this->setError(elFinder::ERROR_PERM_DENIED); } if (!$this->nameAccepted($name)) { return $this->setError(elFinder::ERROR_INVALID_NAME, $name); } $mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name)...
Base
1
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...
Base
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Class
2
protected function signDocument(\DOMDocument $document, $node) { $this->add509Cert($this->getCertificate()->getPublicKey()->getX509Certificate()); $this->setCanonicalMethod(XMLSecurityDSig::EXC_C14N); $this->addReference($document->documentElement, XMLSecurityDSig::SHA1, array('http://ww...
Base
1
public function IsQmail() { if (stristr(ini_get('sendmail_path'), 'qmail')) { $this->Sendmail = '/var/qmail/bin/sendmail'; } $this->Mailer = 'sendmail'; }
Class
2
public function testGetEvents(){ TestingAuxLib::loadX2NonWebUser (); TestingAuxLib::suLogin ('admin'); Yii::app()->settings->historyPrivacy = null; $lastEventId = 0; $lastTimestamp = 0; $events = Events::getEvents ($lastEventId, $lastTimestamp, 4); $this->ass...
Class
2
public static function pathFile($path, $file=false) { if($file!==false){ $fullPath = $path.$file; } else { $fullPath = $path; } // Fix for Windows on paths. eg: $path = c:\diego/page/subpage convert to c:\diego\page\subpages $fullPath = str_replace('/', DS, $fullPath); if(CHECK_SYMBOLIC_LINKS) {...
Base
1
public static function DragnDropReRank2() { global $router, $db; $id = $router->params['id']; $page = new section($id); $old_rank = $page->rank; $old_parent = $page->parent; $new_rank = $router->params['position'] + 1; // rank $new_parent = intval($r...
Base
1
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Class
2
print_r($single_error); } echo '</pre>'; }
Class
2
public function addGroupBy( $groupBy ) { if ( empty( $groupBy ) ) { throw new \MWException( __METHOD__ . ': An empty group by clause was passed.' ); } $this->groupBy[] = $groupBy; return true; }
Class
2
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
static function isSearchable() { return true; }
Base
1
public function backup($type='json') { global $DB; global $website; $DB->query(' SELECT * FROM nv_blocks WHERE website = '.protect($website->id), 'object' ); $out = $DB->result(); if($type='json') ...
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
public function testCompilePathIsProperlyCreated() { $compiler = new BladeCompiler($this->getFiles(), __DIR__); $this->assertEquals(__DIR__.'/'.sha1('foo').'.php', $compiler->getCompiledPath('foo')); }
Class
2
foreach ($days as $value) { $regitem[] = $value; }
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
foreach ($allowedFolders as $folder) { if ('/' . $folder === substr($uri, 0, 1 + strlen($folder))) { header('Content-Type: ' . $this->getMime($filePath)); readfile($filePath); return true; } }
Base
1
private function load($id) { global $zdb; try { $select = $zdb->select(self::TABLE); $select->limit(1) ->where(self::PK . ' = ' . $id); $results = $zdb->execute($select); $this->loadFromRs($results->current()); } catch (Thr...
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...
Base
1
public function getTrustedProxyData() { return array( array(array(), array('127.0.0.1')), array(array('10.0.0.2'), array('10.0.0.2', '127.0.0.1')), array(array('10.0.0.2', '127.0.0.1'), array('10.0.0.2', '127.0.0.1')), ); }
Class
2
$count += $db->dropTable($basename); } flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.'); expHistory::back(); }
Base
1
public function getMailingDetails($id) { trigger_error(sprintf('%s:%s is deprecated since Shopware 5.6 and will be private with 5.8.', __CLASS__, __METHOD__), E_USER_DEPRECATED); $details = Shopware()->Modules()->Marketing()->sMailCampaignsGetDetail((int) $id); foreach ($details['conta...
Base
1
public function backup($type='json') { global $DB; global $website; $DB->query('SELECT * FROM nv_orders WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; ...
Base
1
public function testValidatesUriCanBeParsed() { new Uri('///'); }
Base
1
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_re...
Base
1
public function showall() { global $user, $sectionObj, $sections; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // all we need to do is determine the current section $navsections = $sections; if ($sectionObj-...
Base
1
self::assertSame($shouldBePresent, $request->hasHeader('Authorization')); self::assertSame($shouldBePresent, $request->hasHeader('Cookie')); return new Response(200); } ]);
Class
2
private function normalize($str, $opts) { if ($opts['nfc'] || $opts['nfkc']) { if (class_exists('Normalizer', false)) { if ($opts['nfc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_C)) $str = Normalizer::normalize($str, Normalizer::FORM_C); if ($opts['nfkc'] && ! Normalizer::isNormalized($st...
Base
1
public function update() { global $DB; global $events; if(!is_array($this->categories)) $this->categories = array(); $ok = $DB->execute(' UPDATE nv_feeds SET categories = :categories, format = :format, image = :image, entries = :entries, content = :content, views = :views...
Base
1
private function deleteDir($dirPath) { if (!is_dir($dirPath)) { $success = unlink($dirPath); } else { $success = true; foreach (array_reverse(elFinderVolumeFTP::listFilesInDirectory($dirPath, false)) as $path) { $path = $dirPath . DIRECTORY_SEPARATOR . $path; if(is_link($path)) { unlink($pat...
Base
1
private function initData() { $this->Set('customer', 0, true, true); $this->Set('admin', 1, true, true); $this->Set('subject', '', true, true); $this->Set('category', '0', true, true); $this->Set('priority', '2', true, true); $this->Set('message', '', true, true); $this->Set('dt', 0, true, true); $thi...
Class
2
function edit_option_master() { expHistory::set('editable', $this->params); $params = isset($this->params['id']) ? $this->params['id'] : $this->params; $record = new option_master($params); assign_to_template(array( 'record'=>$record )); }
Base
1
function draw_cdef_preview($cdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>cdef=<?php print get_cdef($cdef_id, true);?></pre> </td> </tr> <?php }
Base
1
public function testGetConfigWithBrokenSystem() { $slideshow = true; $exceptionMessage = 'Aïe!'; $this->configService->expects($this->any()) ->method('getFeaturesList') ->willThrowException(new ServiceException($exceptionMessage)); // Default status code when something breaks $status = Http::ST...
Base
1