code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
$input = (function ($settingName, $setting, $appView) { $settingId = str_replace('.', '_', $settingName); return $this->Bootstrap->switch([ 'label' => h($setting['description']), 'checked' => !empty($setting['value']), 'id' => $settingId, ...
Base
1
foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ...
Class
2
public function getUserList() { $result = []; $users = CodeModel::all(User::tableName(), 'nick', 'nick', false); foreach ($users as $codeModel) { if ($codeModel->code != 'admin') { $result[$codeModel->code] = $codeModel->description; } } ...
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['requi...
Base
1
public function rename() { if (!AuthUser::hasPermission('file_manager_rename')) { Flash::set('error', __('You do not have sufficient permissions to rename this file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks i...
Class
2
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
public static function wpSetUpBeforeClass( $factory ) { self::make_user_by_role( 'administrator' ); self::$post = $factory->post->create_and_get(); }
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
public function getClone($modelId = null) { $this->authorize('view', AssetModel::class); // Check if the model exists if (is_null($model_to_clone = AssetModel::find($modelId))) { return redirect()->route('models.index')->with('error', trans('admin/models/message.does_not_exis...
Class
2
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
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
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 add_application($uniq_name_orig,$uniq_name,$process_name,$display,$url,$command,$type,$min_value,$bdd){ if($type != 'MIN'){ $min_value = ""; } $sql = "select count(*) from bp where name = '" . $uniq_name . "';"; $req = $bdd->query($sql); $bp_exist = $req->fetch(); // add if($bp_exist[0] == 0 and empt...
Base
1
public function getQuerySelect() { return ''; }
Base
1
public static function getModelTypes($assoc = false) { $modelTypes = Yii::app()->db->createCommand() ->selectDistinct('modelName') ->from('x2_fields') ->where('modelName!="Calendar"') ->order('modelName ASC') ->queryColumn(); ...
Class
2
public function admin_print_scripts( $not_used ) { // Load any uploaded KML into the search map - only works with browser uploader // See if wp_upload_handler found uploaded KML $kml_url = get_transient( 'gm_uploaded_kml_url' ); if (strlen($kml_url) > 0) { // Load the KML in the location editor ...
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
foreach ($days as $event) { if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break; if (empty($event->eventstart)) $eve...
Base
1
public function subscriptions() { global $db; expHistory::set('manageable', $this->params); // make sure we have what we need. if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.')); if (empty($this->par...
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...
Base
1
public function testCreatesResponseWithAddedHeaderArray() { $r = new Response(); $r2 = $r->withAddedHeader('foo', ['baz', 'bar']); $this->assertFalse($r->hasHeader('foo')); $this->assertEquals('baz, bar', $r2->getHeaderLine('foo')); }
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
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 renderRequest() { $request = ''; foreach ($this->displayVars as $name) { if (!empty($GLOBALS[$name])) { $request .= '$' . $name . ' = ' . VarDumper::export($GLOBALS[$name]) . ";\n\n"; } } return '<pre>' . rtrim($request, "\...
Base
1
public function update($user, $notrigger = 0) { global $langs, $conf; $error = 0; // Clean parameters $this->address = ($this->address > 0 ? $this->address : $this->address); $this->zip = ($this->zip > 0 ? $this->zip : $this->zip); $this->town = ($this->town > 0 ? $this->town : $this->town); $this->co...
Class
2
protected function encode($path) { if ($path !== '') { // cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root $p = $this->relpathCE($path); // if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt if ($p === '') { ...
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
function sigRenderTag ($input, array $args, Parser $parser, PPFrame $frame) { $username = $input; $img_url = sigGetAvatarUrl($username); $o = '<br>' . '<span class="scratch-sig">' . '<a href="/wiki/User:'.$username.'">' . '<img src="' . $img_url . '" width="18px" height="18px">' ...
Base
1
public function testLegacyDispatch() { $event = new Event(); $return = $this->dispatcher->dispatch(self::preFoo, $event); $this->assertEquals('pre.foo', $event->getName()); }
Base
1
protected function get_remote_contents(&$url, $timeout = 30, $redirect_max = 5, $ua = 'Mozilla/5.0', $fp = null) { if (preg_match('~^(?:ht|f)tps?://[-_.!\~*\'()a-z0-9;/?:\@&=+\$,%#\*\[\]]+~i', $url)) { $info = parse_url($url); $host = strtolower($info['host']); // do ...
Base
1
public function __construct() { $this->options['alias'] = ''; // alias to replace root dir name $this->options['dirMode'] = 0755; // new dirs mode $this->options['fileMode'] = 0644; // new files mode $this->options['quarantine'] = '.quarantine'; // quarantine folder name...
Base
1
function scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); ...
Base
1
function edit() { global $template; parent::edit(); $allforms = array(); $allforms[""] = gt('Disallow Feedback'); // calculate which event date is the one being edited $event_key = 0; foreach ($template->tpl->tpl_vars['record']->value->eventdate as $k...
Class
2
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
protected function markCompleted($endStatus, ServiceResponse $serviceResponse, $gatewayMessage) { parent::markCompleted($endStatus, $serviceResponse, $gatewayMessage); $this->createMessage(Message\PurchasedResponse::class, $gatewayMessage); ErrorHandling::safeExtend($this->payment, 'onCa...
Class
2
public function saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->...
Class
2
private function resize($src, $srcImgInfo, $maxWidth, $maxHeight, $quality, $preserveExif) { $zoom = min(($maxWidth/$srcImgInfo[0]),($maxHeight/$srcImgInfo[1])); $width = round($srcImgInfo[0] * $zoom); $height = round($srcImgInfo[1] * $zoom); if (class_exists('Imagick', false)) { return $this->resize_ima...
Base
1
public function getMovie($id){ $url = "http://api.themoviedb.org/3/movie/".$id."?api_key=".$this->apikey; $movie = $this->curl($url); return $movie; }
Base
1
public static function modList(){ //$mod = ''; $handle = dir(GX_MOD); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $dir = GX_MOD.$entry; if(is_dir($dir) == true){ $mod...
Base
1
public static function quoteValue($value) { if ($value instanceof QueryParam || $value instanceof QueryExpression) { //no quote for query parameters nor expressions $value = $value->getValue(); } else if ($value === null || $value === 'NULL' || $value === 'null') { $value = 'NU...
Base
1
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_x2leads WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command-...
Base
1
function XMLRPCgetUserGroupPrivs($name, $affiliation, $nodeid){ require_once(".ht-inc/privileges.php"); global $user; if(! checkUserHasPriv("userGrant", $user['id'], $nodeid)){ return array('status' => 'error', 'errorcode' => 53, 'errormsg' => 'Unable to ad...
Class
2
public function execute(&$params){ $model = new Actions; $model->type = 'note'; $model->complete = 'Yes'; $model->associationId = $params['model']->id; $model->associationType = $params['model']->module; $model->actionDescription = $this->parseOption('comment', $param...
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
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
protected function assertNoPHPErrors () { $this->assertElementNotPresent('css=.xdebug-error'); $this->assertElementNotPresent('css=#x2-php-error'); }
Class
2
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...
Class
2
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
Base
1
function PMA_importAjaxStatus($id) { header('Content-type: application/json'); echo json_encode( $_SESSION[$GLOBALS['SESSION_KEY']]['handler']::getUploadStatus($id) ); }
Base
1
public function destroy(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(...
Compound
4
public function getCookiePathsDataProvider() { return [ ['', '/'], ['/', '/'], ['/foo', '/'], ['/foo/bar', '/foo'], ['/foo/bar/', '/foo/bar'], ['foo', '/'], ['foo/bar', '/'], ['foo/bar/', '/'], ]; ...
Class
2
public static function getMenuRaw($menuid){ $sql = sprintf("SELECT * FROM `menus` WHERE `menuid` = '%s' ORDER BY `order` ASC", $menuid); $menus = Db::result($sql); $n = Db::$num_rows; return $menus; }
Base
1
public function save_change_password() { global $user; $isuser = ($this->params['uid'] == $user->id) ? 1 : 0; if (!$user->isAdmin() && !$isuser) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } ...
Base
1
public function get_view_config() { global $template; // set paths we will search in for the view $paths = array( BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure', BASE.'framework/modules/common/views/file/configure', ); fo...
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_files WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); ...
Base
1
function XMLRPCaddResourceGroupPriv($name, $type, $nodeid, $permissions){ require_once(".ht-inc/privileges.php"); global $user; if(! checkUserHasPriv("resourceGrant", $user['id'], $nodeid)){ return array('status' => 'error', 'errorcode' => 53, 'errormsg' =>...
Class
2
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; ...
Base
1
$layout[$loc] = array_merge($layout[$loc],$data); } } } return $layout; }
Base
1
public function rules() { return [ 'name' => 'required', 'email' => 'required|email', 'address' => '', 'primary_number' => 'numeric', 'secondary_number' => 'numeric', 'password' => 'required|min:5|confirmed', 'password_c...
Class
2
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
$user = db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($check['user']), 'username'); form_alternate_row('line' . $check['id']); $name = get_data_source_title($check['datasource']); $title = $name; if (strlen($name) > 50) { $name = substr($name, 0, 50); } form_select...
Base
1
function import() { $pullable_modules = expModules::listInstalledControllers($this->baseclassname); $modules = new expPaginator(array( 'records' => $pullable_modules, 'controller' => $this->loc->mod, 'action' => $this->params['action'], 'order' ...
Base
1
public function addReplyTo($address, $name = '') { return $this->addAnAddress('Reply-To', $address, $name); }
Compound
4
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
protected function sort(&$rowsKey, $sortColumn) { $sortMethod = $this->getTableSortMethod(); if ($sortColumn < 0) { switch ($sortMethod) { case 'natural': // Reverse natsort() uasort($rowsKey, function($first, $second) { return strnatcmp($second, $first); ...
Class
2
$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
public function AddCC($address, $name = '') { return $this->AddAnAddress('cc', $address, $name); }
Class
2
function edit() { global $user; /* 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']) ? SIMPLENOTE_REQUIRE_LOG...
Base
1
$clientIps = array_map('trim', explode(',', $this->headers->get(self::$trustedHeaders[self::HEADER_CLIENT_IP])));
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; }
Class
2
public static function restoreX2WebUser () { if (isset (self::$_oldUserComponent)) { Yii::app()->setComponent ('user', self::$_oldUserComponent); } else { throw new CException ('X2WebUser component could not be restored'); } }
Base
1
public function __construct () { if (self::existConf()) { # code... self::config('config'); self::lang(GX_LANG); }else{ GxMain::install(); } }
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...
Class
2
function URLEscape( $string ) { $string = preg_replace_callback( // Match both decimal & hex code (although hex codes can contain a-f letters). // Should be enough as the alphabet hex codes only have numbers. "/(&#x?[0-9]+;?)/i", function( $match ) { if ( mb_substr( $match[1], -1 ) !== ';' ) { // Fix...
Base
1
function html_edit_form($param) { global $TEXT; if ($param['target'] !== 'section') { msg('No editor for edit target ' . $param['target'] . ' found.', -1); } $attr = array('tabindex'=>'1'); if (!$param['wr']) $attr['readonly'] = 'readonly'; $param['form']->addElement(form_makeWikiText...
Base
1
function edit_freeform() { $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
public function handleObjectDeletionFromUserSide($confirm_msg = false, $op='del') { global $icmsTpl, $impresscms; $objectid = ( isset($_REQUEST[$this->handler->keyName]) ) ? (int) ($_REQUEST[$this->handler->keyName]) : 0; $icmsObj = $this->handler->get($objectid); if ($icmsObj->isNew()) { redirect_...
Base
1
public function get($extramediatypes = false) { try { return $this->getConfig($extramediatypes); } catch (\Exception $exception) { return $this->jsonError($exception); } }
Base
1
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
Base
1
private function getUrlencodedPrefix($string, $prefix) { if (0 !== strpos(rawurldecode($string), $prefix)) { return false; } $len = strlen($prefix); if (preg_match(sprintf('#^(%%[[:xdigit:]]{2}|.){%d}#', $len), $string, $match)) { return $match[0]; ...
Base
1
public static function run () { $m = self::match(); // print_r($m); if (is_array($m)) { # code... $val = self::extract($m[0], $m[1]); if (isset($val) && $val != null ) { return $val; }else{ $va...
Base
1
public static function checkPermissions($permission,$location) { global $exponent_permissions_r, $router; // only applies to the 'manage' method if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($...
Base
1
public function getFileAndFolderNameFilters() { return $this->fileAndFolderNameFilters; }
Base
1
static function displayname() { return gt("Navigation"); }
Base
1
private function _createdby( $option ) { $this->addTable( 'revision', 'creation_rev' ); $this->addTable( 'revision_actor_temp', 'creation_rev_actor' ); $this->_adduser( null, 'creation_rev_actor' ); $user = new \User; $this->addWhere( [ $this->DB->addQuotes( $user->newFromName( $option )->getActorId(...
Class
2
public static function slug($vars) { $s = Db::result("SELECT `slug` FROM `posts` WHERE `id` = '{$vars}' LIMIT 1"); $s = $s[0]->slug; return $s; }
Base
1
public function beforeSave () { $valid = parent::beforeSave (); if ($valid) { $table = Yii::app()->db->schema->tables[$this->myTableName]; $existing = array_key_exists($this->fieldName, $table->columns) && $table->columns[$this->fieldName] instanceof CDbColum...
Class
2
foreach ($matches[1] as $index => $body) { $parts = explode('_', $body); $fileID = $parts[0]; $hash = $parts[1]; try { $file = erLhcoreClassModelChatFile::fetch($fileID); if (i...
Class
2
public function editspeed() { 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']); assign_to_template(array( 'calculato...
Class
2
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
Base
1
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
public static function ca() { if (is_null(self::$ca)) new CertificateAuthenticate(); return self::$ca; }
Base
1
function delete_vendor() { global $db; if (!empty($this->params['id'])){ $db->delete('vendor', 'id =' .$this->params['id']); } expHistory::back(); }
Class
2
public function Mail($from) { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Mail() without being connected"); return false; } $useVerp = ($this->do_verp ? " XVERP" : ""); fputs($this->smtp_conn,"MAIL...
Base
1
function searchName() { return gt('Webpage'); }
Base
1
function RemoveXSSchars(&$val) { static $patterns = NULL; static $replacements = NULL; $val_before = $val; $found = true; if ( $patterns == NULL ) { $patterns = array(); $replacements = array(); // remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are // allowed this prevents s...
Base
1
function clean_input_value($value) { if (is_string($value)) { return descript($value); } if (is_array($value)) { return array_map('descript', $value); } return ''; }
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 static function get_session($vars) { }
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