code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
function testCommandCategorieExistence ($name = NULL) { global $pearDB, $form; $id = NULL; if (isset($form)) $id = $form->getSubmitValue('cmd_category_id'); $DBRESULT = $pearDB->query("SELECT `category_name`, `cmd_category_id` FROM `command_categories` WHERE `category_name` = '".htmlentities($name, EN...
Base
1
public function approve_toggle() { 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 // $require_login = empty($this->params['re...
Base
1
public static function secure() { if (!isset($_SESSION['gxsess']['val']['loggedin']) && !isset($_SESSION['gxsess']['val']['username']) ) { header('location: login.php'); } else { return true; } }
Base
1
public function LoadHashPaths($tree) { if (!$tree) return; $treePaths = array(); $blobPaths = array(); $args = array(); $args[] = '--full-name'; $args[] = '-r'; $args[] = '-t'; $args[] = $tree->GetHash(); $lines = explode("\n", $this->exe->Execute($tree->GetProject()->GetPath(), GIT_LS_TREE, $...
Base
1
public function testCreateRelationshipMeta() { // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta(null, null, null, array(), null); self::assertCount(1, $GLOBALS['log']->calls['fatal']); // test $GLOBALS['log']->reset(); SugarBean::create...
Base
1
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
Class
2
foreach ($events as $event) { $extevents[$date][] = $event; }
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 insert() { global $DB; $ok = $DB->execute(' INSERT INTO nv_menus (id, codename, icon, lid, notes, functions, enabled) VALUES ( 0, :codename, :icon, :lid, :notes, :functions, :enabled)', array( 'codename' => value_or_default($this->codename, ""), 'icon' =...
Base
1
public function checkOverlap() { try { $select = $this->zdb->select(self::TABLE, 'c'); $select->columns( array('date_debut_cotis', 'date_fin_cotis') )->join( array('ct' => PREFIX_DB . ContributionsTypes::TABLE), 'c.' . C...
Base
1
public function withFragment($fragment) { if (substr($fragment, 0, 1) === '#') { $fragment = substr($fragment, 1); } $fragment = $this->filterQueryAndFragment($fragment); if ($this->fragment === $fragment) { return $this; } $new = clone ...
Base
1
public function afterSave($event) { // look up current tags $oldTags = $this->getTags(); $newTags = array(); foreach ($this->scanForTags() as $tag) { if (!in_array($tag, $oldTags)) { // don't add duplicates if there are already tags $tagModel = new Tags; ...
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 ...
Base
1
protected function _mkdir($path, $name) { $path = $this->_joinPath($path, $name); if ($this->connect->mkdir($path) === false) { return false; } $this->options['dirMode'] && $this->connect->chmod($this->options['dirMode'], $path); return $path; }
Base
1
public function getAcl($node) { if (is_string($node)) { $node = $this->server->tree->getNodeForPath($node); } $acl = parent::getAcl($node); // Authenticated user have read access to all nodes, as node list only contains elements // that user can read. $acl[] = [ ...
Class
2
public function getFormat($mimeType) { if (false !== $pos = strpos($mimeType, ';')) { $mimeType = substr($mimeType, 0, $pos); } if (null === static::$formats) { static::initializeFormats(); } foreach (static::$formats as $format => $mimeTypes) { ...
Base
1
public function gc($maxlifetime) { $this->getCollection()->remove(array( $this->options['expiry_field'] => array('$lt' => new \MongoDate()), )); return true; }
Base
1
public function disable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successful...
Base
1
function edit_vendor() { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); assign_to_template(array( 'vendor'=>$vendor )); } }
Base
1
public static function title($id){ $sql = sprintf("SELECT `title` FROM `posts` WHERE `id` = '%d'", $id); try { $r = Db::result($sql); if(isset($r['error'])){ $title['error'] = $r['error']; //echo $title['error']; }el...
Base
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
Base
1
public static function delete($id){ $sql = array( 'table' => 'menus', 'where' => array( 'id' => $id ) ); $menu = Db::delete($sql); }
Base
1
function functions_list() { $navibars = new navibars(); $navitable = new navitable("functions_list"); $navibars->title(t(244, 'Menus')); $navibars->add_actions( array( '<a href="?fid='.$_REQUEST['fid'].'&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> '.t(38, 'Create').'...
Base
1
private function flatten(iterable $array, array &$result, string $keySeparator, string $parentKey = '', bool $escapeFormulas = false) { foreach ($array as $key => $value) { if (is_iterable($value)) { $this->flatten($value, $result, $keySeparator, $parentKey.$key.$keySeparator...
Base
1
$filename = isset($_REQUEST[$request]) ? trim($_REQUEST[$request]) : false; if (!$filename || empty($filename)) { continue; } if ($filename == wCMS::get('config', 'theme')) { wCMS::alert('danger', 'Cannot delete currently active theme.'); wCMS::redirect(); continue; ...
Base
1
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 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
private function LoadData() { $this->dataLoaded = true; $args = array(); $args[] = '-s'; $args[] = '-l'; $args[] = $this->commitHash; $args[] = '--'; $args[] = $this->path; $blamelines = explode("\n", $this->exe->Execute($this->project->GetPath(), GIT_BLAME, $args)); $lastcommit = ''; foreach (...
Base
1
protected function remove($path, $force = false) { $stat = $this->stat($path); if (empty($stat)) { return $this->setError(elFinder::ERROR_RM, $path, elFinder::ERROR_FILE_NOT_FOUND); } $stat['realpath'] = $path; $this->rmTmb($stat); $this->clearcache(...
Base
1
$count += $db->dropTable($basename); } flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.'); expHistory::back(); }
Base
1
public function delete() { if (!AuthUser::hasPermission('file_manager_delete')) { Flash::set('error', __('You do not have sufficient permissions to delete a file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } $paths = func_get_args(); ...
Class
2
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
public function getQuerySelect() { return ''; }
Base
1
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title('Kimai installation running ...'); /** @var Application $application */ $application = $this->getApplication(); /** @var KernelInterface $ker...
Base
1
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
Base
1
public function testAllowsFalseyUrlParts() { $url = new Uri('http://a:1/0?0#0'); $this->assertSame('a', $url->getHost()); $this->assertEquals(1, $url->getPort()); $this->assertSame('/0', $url->getPath()); $this->assertEquals('0', (string) $url->getQuery()); $this-...
Base
1
public function load_from_post() { $this->codename = $_REQUEST['codename']; $this->icon = $_REQUEST['icon']; $this->lid = $_REQUEST['lid']; $this->notes = $_REQUEST['notes']; $this->enabled = ($_REQUEST['enabled']=='1'? '1' : '0'); // load associated functions $f...
Base
1
public function params() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) { $this->create(); return; } $action = $this->act...
Class
2
function teampass_whitelist() { $bdd = teampass_connect(); $apiip_pool = teampass_get_ips(); if (count($apiip_pool) > 0 && !array_search($_SERVER['REMOTE_ADDR'], $apiip_pool)) { rest_error('IPWHITELIST'); } }
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
public function fetchSGOrgRow($id, $removable = false, $extend = false) { $this->layout = false; $this->autoRender = false; $this->set('id', $id); $this->set('removable', $removable); $this->set('extend', $extend); $this->render('ajax/sg_org_row_empty'); }
Base
1
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
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 static function makeConfig ($file) { $config = "<?php if(!defined('GX_LIB')) die(\"Direct Access Not Allowed!\"); /** * GeniXCMS - Content Management System * * PHP Based Content Management System and Framework * * @package GeniXCMS * @since 0.0.1 build date 20140925 * @version 0.0.8 * @lin...
Base
1
$trimmed = trim($line); if ((strlen($trimmed) > 0) || ($readInitialData === true)) { $comment[] = $line; } $readInitialData = true; } switch ($type) { case 'commit': $object = $objectHash; $commitHash = $objectHash; break; case 'tag': $args = array(); $args[] = 'tag'; ...
Base
1
$va[] = [$k2 => $m[$v2]];
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
public function __construct () { if (self::existConf()) { # code... self::config('config'); self::lang(GX_LANG); }else{ GxMain::install(); } }
Compound
4
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...
Base
1
function get_allowed_mime_types( $user = null ) { $t = wp_get_mime_types(); unset( $t['swf'], $t['exe'] ); if ( function_exists( 'current_user_can' ) ) $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' ); if ( empty( $unfiltered ) ) unset( $t['htm|html'] ); /**...
Base
1
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
function info_application($bp_name, $bdd){ $sql = "select * from bp where name = '" . $bp_name . "'"; $req = $bdd->query($sql); $info = $req->fetch(); echo json_encode($info); }
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 ...
Base
1
public function confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, 'proje...
Base
1
public final function setAction($strAction) { $this->strAction = $strAction; }
Base
1
function manage() { expHistory::set('viewable', $this->params); // $category = new storeCategory(); // $categories = $category->getFullTree(); // // // foreach($categories as $i=>$val){ // // if (!empty($this->values) && in_ar...
Class
2
foreach ($project_templates as $project_template) { if ((int) $project_template->getGroupId() === \Project::ADMIN_PROJECT_ID) { continue; } $company_templates[] = new CompanyTemplate($project_template, $this->glyph_finder); }
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...
Base
1
public function showall() { expHistory::set('viewable', $this->params); // figure out if should limit the results if (isset($this->params['limit'])) { $limit = $this->params['limit'] == 'none' ? null : $this->params['limit']; } else { $limit = (isset($this->co...
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
public function update_groupdiscounts() { global $db; if (empty($this->params['id'])) { // look for existing discounts for the same group $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']); if (!empty($existing_id)) flashAndFlow('er...
Base
1
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...
Base
1
function GenerateCryptKey($size = "", $secure = false, $numerals = false, $capitalize = false, $ambiguous = false, $symbols = false) { // load library $pwgen = new SplClassLoader('Encryption\PwGen', '../includes/libraries'); $pwgen->register(); $pwgen = new Encryption\PwGen\pwgen(); // init if ...
Base
1
$class = $container->getParameterBag()->resolveValue($def->getClass()); $refClass = new \ReflectionClass($class); $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; if (!$refClass->implementsInterface($interface)) { throw new \Inva...
Base
1
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...
Class
2
return $fa->nameGlyph($icons, 'icon-'); } } else { return array(); } }
Base
1
public function testNewInstanceWhenNewProtocol() { $r = new Response(200); $this->assertNotSame($r, $r->withProtocolVersion('1.0')); }
Base
1
function edit() { if (empty($this->params['content_id'])) { flash('message',gt('An error occurred: No content id set.')); expHistory::back(); } /* The global constants can be overridden by passing appropriate params */ //sure wish I could do this once in the constructo...
Base
1
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
static function description() { return gt("This module is for managing categories in your store."); }
Base
1
public function __toString() { $str = $this->data['Name'] . '=' . $this->data['Value'] . '; '; foreach ($this->data as $k => $v) { if ($k != 'Name' && $k != 'Value' && $v !== null && $v !== false) { if ($k == 'Expires') { $str .= 'Expires=' . gmdat...
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
static public function getInstanceOf($_usernfo, $_tid) { if (!isset(self::$tickets[$_tid])) { self::$tickets[$_tid] = new ticket($_usernfo, $_tid); } return self::$tickets[$_tid]; }
Class
2
public static function canView($section) { global $db; if ($section == null) { return false; } if ($section->public == 0) { // Not a public section. Check permissions. return expPermissions::check('view', expCore::makeLocation('navigation...
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, ))); }
Base
1
function generateAutoLoginLink($params){ $dataRequest = array(); $dataRequestAppend = array(); // Destination ID if (isset($params['r'])){ $dataRequest['r'] = $params['r']; $dataRequestAppend[] = '/(r)/'.rawurlencode(base64_encode($params['r'])); } ...
Class
2
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 testSettingCookie() { $_SERVER['REQUEST_METHOD'] = 'GET'; $controller = $this->getMock('Cake\Controller\Controller', ['redirect']); $controller->request = new Request(['webroot' => '/dir/']); $controller->response = new Response(); $event = new Event('Co...
Compound
4
public function getOnClickAction() { return 'javascript:openNewGal(\''.$this->stack_name.'\');'; }
Base
1
private static function sesKey() { $ip = $_SERVER['REMOTE_ADDR']; $browser = $_SERVER['HTTP_USER_AGENT']; $dt = date("Y-m-d H"); $key = md5($ip.$browser.$dt); return $key; }
Base
1
public function __construct() { if (System::existConf()) { new System(); }else{ $this->install(); } }
Base
1
private function _notlastmodifiedby( $option ) { $user = new \User; $this->addWhere( $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' != (SELECT revactor_actor FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id O...
Class
2
public function skip($value) { return $this->offset($value); }
Base
1
public function getItems2 ( $prefix='', $page=0, $limit=20, $valueAttr='name', $nameAttr='name') { $modelClass = get_class ($this->owner); $model = CActiveRecord::model ($modelClass); $table = $model->tableName (); $offset = intval ($page) * intval ($limit); AuxLib:...
Base
1
function reset_stats() { // global $db; // reset the counters // $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1'); banner::resetImpressions(); // $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1'); banner::resetClicks(); /...
Class
2
public function testNewInstanceWhenRemovingHeader() { $r = new Response(200, ['Foo' => 'Bar']); $r2 = $r->withoutHeader('Foo'); $this->assertNotSame($r, $r2); $this->assertFalse($r2->hasHeader('foo')); }
Base
1
public function showall() { expHistory::set('viewable', $this->params); $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'show...
Class
2
static function isSearchable() { return true; }
Base
1
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 getRawRevisionsAndCount($limit, PFUser $author) { return svn_get_revisions( $this->project, 0, $limit, '', $author->getUserName(), '', '', 0, false ); }
Base
1
public function getFilePath($fileName = null) { if ($fileName === null) { $fileName = $this->fileName; } return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName; }
Base
1
public function rules() { $ignore = Rule::unique('users')->ignore($this->id ?? 0, 'id'); return [ 'email' => [ $ignore, ], 'username' => [ $ignore, ], ]; }
Base
1
function edit_internalalias() { $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 ...
Base
1
foreach ($elem[2] as $field) { echo ' <tr class="tr_cf tr_fields hidden" id="cf_tr_'.$field[0].'"> <td valign="top" class="td_title">&nbsp;&nbsp;<i class="fa fa-caret-right"></i>&nbsp;<i>'.$field[1].'</i> :</td> <td>'; i...
Class
2
protected function _setContent($path, $fp) { rewind($fp); $fstat = fstat($fp); $size = $fstat['size']; }
Base
1
public function scopeSearch(Builder $query, array $search = []) { if (empty($search)) { return $query; } if (!array_intersect(array_keys($search), $this->searchable)) { return $query; } return $query->where($search); }
Class
2
function VerifyVariableSchedule_Update($columns) { // $teacher=$columns['TEACHER_ID']; // $secteacher=$columns['SECONDARY_TEACHER_ID']; // if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='') // { // $all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); //...
Base
1
public function create_file() { if (!AuthUser::hasPermission('file_manager_mkfile')) { Flash::set('error', __('You do not have sufficient permissions to create a file.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_...
Class
2
$t = preg_split('/[ \t]/', trim($enclosure[2]) ); $type = $t[0]; /** * Filters the RSS enclosure HTML link tag for the current post. * * @since 2.2.0 * * @param string $html_link_tag The HTML link tag with a URI and other attributes. */ echo apply_filters( 'rss_enclosure',...
Base
1
public static function remove($token){ $json = Options::v('tokens'); $tokens = json_decode($json, true); unset($tokens[$token]); $tokens = json_encode($tokens); if(Options::update('tokens',$tokens)){ return true; }else{ return false; ...
Base
1