code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
public function destroy($id) { $sql = 'DELETE FROM plugin_hudson_widget WHERE id = ' . $id . ' AND owner_id = ' . $this->owner_id . " AND owner_type = '" . $this->owner_type . "'"; db_query($sql); }
Base
1
foreach ($nodes as $node) { if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) { if ($node->active == 1) { $text = str_pad('', ($depth + ($full ...
Base
1
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name); if (!$view) { // unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child $attr = new stdClass(); $attr->class = 'hidde...
Base
1
protected function _mkfile($path, $name) { $path = $this->_joinPath($path, $name); return $this->connect->put($path, '') ? $path : false; /* if ($this->tmp) { $path = $this->_joinPath($path, $name); $local = $this->getTempFile(); $res = touch($local) &...
Base
1
} elseif ( $sSecLabel[0] != '{' ) { $limpos = strpos( $sSecLabel, '[' ); $cutLink = 'default'; $skipPattern = []; if ( $limpos > 0 && $sSecLabel[strlen( $sSecLabel ) - 1] == ']' ) { // regular expressions which define a skip pattern may precede the text $fmtSec = explode( '~...
Class
2
function readline(StreamInterface $stream, $maxLength = null) { $buffer = ''; $size = 0; while (!$stream->eof()) { // Using a loose equality here to match on '' and false. if (null == ($byte = $stream->read(1))) { return $buffer; } $buffer .= $byte; // Br...
Base
1
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
$chrootPath = realpath($chrootPath); if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) { $chrootValid = true; break; } } if ($chrootVal...
Base
1
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...
Base
1
public function addAddress($address, $name = '') { return $this->addAnAddress('to', $address, $name); }
Compound
4
public static function lists($vars) { return Categories::lists($vars); }
Base
1
protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage) { parent::markCompleted($endStatus, $serviceResponse, $gatewayMessage); $this->createMessage(Message\CreateCardResponse::class, $gatewayMessage); ErrorHandling::safeExtend($this->payment, 'onC...
Class
2
public static function parseAndTrimImport($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 = ...
Base
1
public function install () { Session::start(); System::gZip(); Theme::install('header'); Control::handler('install'); Theme::install('footer'); System::Zipped(); }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_websites WHERE id = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); return $out; ...
Base
1
public function __construct(App $app) { $this->Config = $app->Config; $this->Request = $app->Request; $this->Session = $app->Session; }
Base
1
public function testDoesNotAddPortWhenNoPort() { $this->assertEquals('bar', new Uri('//bar')); $this->assertEquals('bar', (new Uri('//bar'))->getHost()); }
Base
1
public function edit(Request $request, TransactionCurrency $currency) { /** @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('fi...
Compound
4
public function actionView($id) { $model = CActiveRecord::model('Docs')->findByPk($id); if (!$this->checkPermissions($model, 'view')) $this->denied (); if(isset($model)){ $permissions=explode(", ",$model->editPermissions); if(in_array(Yii::app()->user->getName(),$permissions)) $editFlag=true; ...
Base
1
public function Quit($close_on_error = true) { $this->error = null; // so there is no confusion if(!$this->connected()) { $this->error = array( "error" => "Called Quit() without being connected"); return false; } // send the quit command to the server fputs($this->smtp_...
Base
1
public function routePostProvider() { return [ ['/api/articles/', 1, 'articles', 'post', false], ['/api/v1/articles/', 1, 'articles', 'post', false], ['/api/v2/articles/', 2, 'articles', 'post', false], ['/api/articles/5', 1, 'articles', 'post', 5...
Base
1
public function __construct() { parent::__construct(); // for flash data $this->load->library('session'); if (!$this->fuel->config('admin_enabled')) show_404(); $this->load->vars(array( 'js' => '', 'css' => css($this->fuel->config('xtra_css')), // use CSS function here because of the asset library...
Compound
4
protected function getFile() { $task_id = $this->request->getIntegerParam('task_id'); $file_id = $this->request->getIntegerParam('file_id'); $model = 'projectFileModel'; if ($task_id > 0) { $model = 'taskFileModel'; $project_id = $this->taskFinderModel->g...
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); }
Class
2
recyclebin::sendToRecycleBin($loc, $parent); //FIXME if we delete the module & sectionref the module completely disappears // if (class_exists($secref->module)) { // $modclass = $secref->module; // //FIXME: more module/controller glue code // ...
Base
1
public static function remove_all($object_type, $object_id) { global $DB; global $website; $DB->execute(' DELETE FROM nv_notes WHERE website = '.protect($website->id).' AND item_type = '.protect($object_type).' AND...
Base
1
public function update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { ...
Base
1
function audit($method, $class, $statement, $formats, $values, $users_id) { $this->method = $method; $this->class = $class; $this->statement = substr(str_replace("'", "", $statement),0,1000)."n"; $this->formats = $formats; $this->values = $values; $this->ip = ge...
Base
1
public function umount() { $this->connect && @ftp_close($this->connect); }
Base
1
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 add($array) { $this->db = array_merge($array, $this->db); }
Base
1
public static function get_param($key = NULL) { $info = [ 'stype' => self::$search_type, 'stext' => self::$search_text, 'method' => self::$search_method, 'datelimit' => self::$search_date_limit, 'fields' => self::$searc...
Compound
4
public static function navtojson() { return json_encode(self::navhierarchy()); }
Base
1
public function __construct() { self::$key = Options::v('google_captcha_sitekey'); self::$secret = Options::v('google_captcha_secret'); self::$lang = Options::v('google_captcha_lang'); }
Base
1
foreach ($nodes as $node) { if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) { if ($node->active == 1) { $text = str_pad('', ($depth + ($full ...
Base
1
public function showImage(string $path) { $path = storage_path('uploads/images/' . $path); if (!file_exists($path)) { throw (new NotFoundException(trans('errors.image_not_found'))) ->setSubtitle(trans('errors.image_not_found_subtitle')) ->setDetails(tr...
Base
1
public function authenticate(CakeRequest $request, CakeResponse $response) { return self::getUser($request); }
Base
1
$variable[$key] = self::filter($val); } } else { // Prevent XSS abuse $variable = preg_replace_callback('#</?([a-z]+)(\s.*)?/?>#i', function($matches) { $tag = strtolower($matches[1]); // Allowed tags if (in_array($tag, array( 'b', 'strong', 'small', 'i', 'em', 'u', 's', 'sub', 'sup', '...
Base
1
public function clearTags() { $this->_tags = array(); // clear tag cache return (bool) CActiveRecord::model('Tags')->deleteAllByAttributes(array( 'type' => get_class($this->getOwner()), 'itemId' => $this->getOwner()->id) ); }
Class
2
private function curl($url){ $ca = curl_init(); curl_setopt($ca, CURLOPT_URL, $url); curl_setopt($ca, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ca, CURLOPT_HEADER, FALSE); curl_setopt($ca, CURLOPT_HTTPHEADER, array("Accept: application/json")); $response = cur...
Base
1
public function testXForwarderForHeaderForPassRequests() { $this->setNextResponse(); $server = array('REMOTE_ADDR' => '10.0.0.1'); $this->request('POST', '/', $server); $this->assertEquals('10.0.0.1', $this->kernel->getBackendRequest()->headers->get('X-Forwarded-For')); }
Class
2
function RegistrationSaveContactNameFields( $config, $values ) { if ( empty( $values['FIRST_NAME'] ) || empty( $values['LAST_NAME'] ) ) { return 0; } $person_id = DBSeqNextID( 'people_person_id_seq' ); $sql = "INSERT INTO PEOPLE "; $fields = 'PERSON_ID,LAST_NAME,FIRST_NAME,MIDDLE_NAME,'; $values_sql = "'...
Base
1
public function index() { System::gZip(); Control::handler('frontend'); System::Zipped(); }
Base
1
$iloc = expUnserialize($container->internal); if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) { // There is no sectionref for this container. Populate sectionref if ($container->external != "N;") { $newSecRef = new stdClass...
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 =...
Base
1
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
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); }
Class
2
private function SearchFileContents() { $args = array(); $args[] = '-I'; $args[] = '--full-name'; $args[] = '--ignore-case'; $args[] = '-n'; $args[] = '-e'; $args[] = '"' . addslashes($this->search) . '"'; $args[] = $this->treeHash; $lines = explode("\n", $this->exe->Execute($this->project->GetPath...
Base
1
$cfgSite->setSetting( 'db', $key, $value); } $cfgSite->setSetting( 'site', 'secrethash', substr(md5(time() . ":" . mt_rand()),0,10)); return true; } else { return $Errors; } }
Base
1
$params = ['uitype' => 71, 'displaytype' => 1, 'typeofdata' => 'N~O', 'isEditableReadOnly' => false, 'maximumlength' => '99999999999999999'];
Class
2
public function update() { global $user; if (expSession::get('customer-signup')) expSession::set('customer-signup', false); if (isset($this->params['address_country_id'])) { $this->params['country'] = $this->params['address_country_id']; unset($this->params['address_cou...
Base
1
function function_exists($name) { if (isset(\yiiunit\framework\base\SecurityTest::$functions[$name])) { return \yiiunit\framework\base\SecurityTest::$functions[$name]; } return \function_exists($name); }
Class
2
function set_menu_tabs() { $this->menu_tabs = array( 'tab1' => __('Ban Users', 'all-in-one-wp-security-and-firewall'), ); }
Base
1
public function searchAdmin(){ $criteria = new CDbCriteria; return $this->searchBase($criteria); }
Class
2
public function updateInfo(){ $user = $this->checkLogin(); $uid = $user['uid']; $name = I("name"); D("User")->where(" uid = '$uid' ")->save(array("name"=>$name)); $this->sendResult(array()); }
Compound
4
private function _addlasteditor( $option ) { //Addlasteditor can not be used with addauthor. if ( !isset( $this->parametersProcessed['addauthor'] ) || !$this->parametersProcessed['addauthor'] ) { $this->addTable( 'revision_actor_temp', 'rev' ); $this->addWhere( [ $this->tableNames['page'] . '.page_i...
Class
2
$_fn[] = self::buildCondition($v, ' && '); } $fn[] = '('.\implode(' || ', $_fn).')'; break; case '$where': if (\is_callable($value)) { // need implementation ...
Base
1
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name); if (!$view) { // unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child $attr = new stdClass(); $attr->class = 'hidde...
Class
2
public static function dropdown($vars){ if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE `status` = '1' AND "; if(isset($vars['type'])) { $where .= " `type` = '{$vars['type']}' AND "; }else{ ...
Base
1
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-",...
Class
2
$sloc = expCore::makeLocation('navigation', null, $section->id); // remove any manage permissions for this page and it's children // $db->delete('userpermission', "module='navigationController' AND internal=".$section->id); // $db->delete('grouppermission', "module='na...
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
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
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 ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ...
Base
1
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1
function test_new_comment_duplicated() { $comment_args = array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => rand_str( 100 ), ), ); // First time it's a valid comment. $result = $this->myxmlrpcserver->wp_newComment( $comment_args ); $this->assertNotIXRError...
Class
2
public function update($id, $label, $extra) { $ret = $this->get($id); if (!$ret) { /* get() already logged and set $this->error. */ return self::ID_NOT_EXITS; } $class = get_class($this); try { $oldlabel = $ret->{$this->flabel}; ...
Base
1
public static function exist($tag) { $sql = "SELECT `name` FROM `cat` WHERE `name` = '{$tag}'"; $q = Db::result($sql); if (Db::$num_rows > 0) { return true; }else{ return false; } }
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
function manage() { global $db; expHistory::set('manageable', $this->params); // $classes = array(); $dir = BASE."framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { ...
Class
2
foreach ( $metric_group_members as $index => $metric_name ) { print " <A HREF=\"./graph_all_periods.php?mobile=1&" . $g_metrics[$metric_name]['graph'] . "\"> <IMG BORDER=0 ALT=\"$clustername\" SRC=\"./graph.php?" . $g_metrics[$metric_name]['graph'] . "\"></A>"; }
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
public static function dplNumParserFunction( &$parser, $text = '' ) { $parser->addTrackingCategory( 'dplnum-parserfunc-tracking-category' ); $num = str_replace( '&#160;', ' ', $text ); $num = str_replace( '&nbsp;', ' ', $text ); $num = preg_replace( '/([0-9])([.])([0-9][0-9]?[^0-9,])/', '\1,\3', $num ); $num...
Class
2
public static function options($var) { $file = GX_MOD.$var.'/options.php'; if(file_exists($file)){ include ($file); } }
Base
1
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.mp4', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.wps', '.ppt'...
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[$i]; if ($value == "''" && substr($string, ...
Base
1
$count += $db->dropTable($basename); } flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.'); expHistory::back(); }
Base
1
private function SendHello($hello, $host) { fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { $this->edebug("SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />'); } if($code != 250) { ...
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 function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $category = $this->getCategory(); if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->...
Base
1
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1
protected function redirectToOperator(Thread $thread, $operator_id) { if ($thread->state != Thread::STATE_CHATTING) { // We can redirect only threads which are in proggress now. return false; } // Redirect the thread $thread->state = Thread::STATE_WAITING...
Base
1
static function displayname() { return gt("Navigation"); }
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
protected function _mkfile($path, $name) { $path = $this->_joinPath($path, $name); if (($fp = @fopen($path, 'w'))) { @fclose($fp); @chmod($path, $this->options['fileMode']); clearstatcache(); return $path; } return false; }
Base
1
public function store($zdb) { $data = array( 'short_label' => $this->short, 'long_label' => $this->long ); try { if ($this->id !== null && $this->id > 0) { $update = $zdb->update(self::TABLE); $update->set($data)->w...
Base
1
public function testGetDropdownValue($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])) { $bk...
Class
2
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...
Class
2
public function approve_toggle() { global $history; if (empty($this->params['id'])) return; /* 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 $r...
Base
1
public function isActive() { if (PHP_VERSION_ID >= 50400) { return $this->active = \PHP_SESSION_ACTIVE === session_status(); } return $this->active; }
Base
1
function __construct() { }
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); ...
Compound
4
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); return $this->connect->rename($source, $target) ? $target : false; }
Base
1
$res = preg_match("/^$map_part/", $this->url_parts[$i]); if ($res != 1) { $matched = false; break; } $pairs[$key] = $this->url_parts[$i]; $i++; } ...
Base
1
private function encloseForCSV($field) { return '"' . cleanCSV($field) . '"'; }
Base
1
function restart($sMessage = '') { $_COOKIE['sessionID'] = phpAds_SessionStart(); OA_Auth::displayLogin($sMessage, $_COOKIE['sessionID']); }
Compound
4
foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ...
Base
1
function delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->par...
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