code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
private function _stablepages( $option ) { if ( function_exists( 'efLoadFlaggedRevs' ) ) { //Do not add this again if 'qualitypages' has already added it. if ( !$this->parametersProcessed['qualitypages'] ) { $this->addJoin( 'flaggedpages', [ "LEFT JOIN", "page_id = fp_page_id" ] ...
Class
2
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)); ...
Class
2
private function _verify($public_key_or_secret, $expected_alg = null) { $segments = explode('.', $this->raw); $signature_base_string = implode('.', array($segments[0], $segments[1])); if (!$expected_alg) { # NOTE: might better to warn here $expected_alg = $this->heade...
Class
2
public static function dropdown($vars) { if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE "; if(isset($vars['parent'])) { $where .= " `parent` = '{$vars['parent']}' "; }else{ $where .= "1...
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 update() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $values = $this->request->getValues(); list($valid, $errors) = $this->tagValidator->validateModification($values); ...
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 logout() { if ($this->Session->check('Auth.User')) { $this->__extralog("logout"); } $this->Flash->info(__('Good-Bye')); $user = $this->User->find('first', array( 'conditions' => array( 'User.id' => $this->Auth->user('id') ...
Class
2
public function withUri(UriInterface $uri, $preserveHost = false) { if ($uri === $this->uri) { return $this; } $new = clone $this; $new->uri = $uri; if (!$preserveHost) { if ($host = $uri->getHost()) { $new->updateHostFromUri($hos...
Base
1
foreach ($events as $event) { $extevents[$date][] = $event; }
Base
1
function XMLRPCgetResourceGroupPrivs($name, $type, $nodeid){ require_once(".ht-inc/privileges.php"); global $user; if(! checkUserHasPriv("resourceGrant", $user['id'], $nodeid)){ return array('status' => 'error', 'errorcode' => 53, 'errormsg' => 'Unable to a...
Class
2
}elseif($p->status == 1){ $status = "<a href=\"index.php?page=users&act=inactive&id={$p->id}&token=".TOKEN."\" class=\"label label-primary\">Active</a>"; }
Base
1
function phpAds_SessionDataFetch() { global $session; $dal = new MAX_Dal_Admin_Session(); // Guard clause: Can't fetch a session without an ID if (empty($_COOKIE['sessionID'])) { return; } $serialized_session = $dal->getSerializedSession($_COOKIE['sessionID']); // This is required be...
Compound
4
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
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $m...
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
function test_allowed_anon_comments() { add_filter( 'xmlrpc_allow_anonymous_comments', '__return_true' ); $comment_args = array( 1, '', '', self::$post->ID, array( 'author' => 'WordPress', 'author_email' => 'noreply@wordpress.org', 'content' => 'Test Anon Comments', ), )...
Class
2
public static function generatePass(){ $vars = microtime().Site::$name.rand(); $hash = sha1($vars.SECURITY_KEY); $pass = substr($hash, 5, 8); return $pass; }
Base
1
public function createBranch($name, $checkout = FALSE) { // git branch $name $this->run('branch', $name); if ($checkout) { $this->checkout($name); } return $this; }
Class
2
function twig_array_filter(Environment $env, $array, $arrow) { if (!twig_test_iterable($array)) { throw new RuntimeError(sprintf('The "filter" filter expects an array or "Traversable", got "%s".', \is_object($array) ? \get_class($array) : \gettype($array))); } if (!$arrow instanceof Closure && $env...
Class
2
private function generateTempFileData() { return [ 'name' => md5(mt_rand()), 'tmp_name' => tempnam(sys_get_temp_dir(), ''), 'type' => 'image/jpeg', 'size' => mt_rand(1000, 10000), 'error' => '0', ]; }
Class
2
foreach ($this->_to_convert as $error) { $message = $this->getMessage($error['field'], $error['rule'], $error['fallback']); // If there is no generic `message()` set or the translated message is not equal to generic message // we can continue without worrying about duplicat...
Base
1
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
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...
Class
2
static function cronCheckUpdate($task) { $result = Toolbox::checkNewVersionAvailable(1); $task->log($result); return 1; }
Compound
4
public function getFlashCookieObject($name) { if (isset($_COOKIE[$name])) { $object = json_decode($_COOKIE[$name], false); setcookie($name, '', time() - 3600, '/'); return $object; } return null; }
Base
1
foreach ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); }
Class
2
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
$row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=$id_parent"); if ($row_rub) { $row['id_rubrique'] = $row_rub['id_rubrique']; } } } } return $row; }
Base
1
public function saveUpdatedUpload(UploadedFile $uploadedFile, Attachment $attachment) { if (!$attachment->external) { $this->deleteFileInStorage($attachment); } $attachmentName = $uploadedFile->getClientOriginalName(); $attachmentPath = $this->putFileInStorage($uploa...
Base
1
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...
Class
2
$contents = ['form' => tep_draw_form('manufacturers', 'manufacturers.php', 'page=' . $_GET['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=save', 'post', 'enctype="multipart/form-data"')];
Base
1
public function actionGetItems(){ // We need to select the id both as 'id' and 'value' in order to correctly populate the association form. $sql = 'SELECT id, id as value FROM x2_services WHERE id LIKE :qterm ORDER BY id ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = ...
Class
2
public function enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully...
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 function __construct() { }
Base
1
static function displayname() { return "Events"; }
Base
1
public function setRemoteUrl($name, $url, array $params = NULL) { $this->run('remote', 'set-url', $params, $name, $url); return $this; }
Class
2
$instance->schema = ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'};
Base
1
function remove() { global $db; $section = $db->selectObject('section', 'id=' . $this->params['id']); if ($section) { section::removeLevel($section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); ...
Base
1
public function pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::ge...
Base
1
function VerifyBlockedSchedule($columns,$course_period_id,$sec,$edit=false) { if($course_period_id!='new') { $cp_det_RET= DBGet(DBQuery("SELECT * FROM course_periods WHERE course_period_id=$course_period_id")); $cp_det_RET=$cp_det_RET[1]; $teacher=$cp_det_RET['TEACHER_ID']; $sectea...
Base
1
public function anyData() { $tasks = Task::with(['user', 'status', 'client'])->select( collect(['external_id', 'title', 'created_at', 'deadline', 'user_assigned_id', 'status_id', 'client_id']) ->map(function ($field) { return (new Task())->qualifyColumn($f...
Base
1
public static function install ($var) { include(GX_PATH.'/gxadmin/themes/install/'.$var.'.php'); }
Base
1
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 save() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { if ($this->categoryModel->create($values) !== false) { $this->f...
Base
1
function new_pass_form() { pagetop(gTxt('tab_site_admin'), ''); echo form( hed(gTxt('change_password'), 2). inputLabel( 'new_pass', fInput('password', 'new_pass', '', '', '', '', INPUT_REGULAR, '', 'new_pass'), 'new_password', '', array('class' => 'txp-form-f...
Base
1
protected function _dirname($path) { return dirname($path); }
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
private function _notlinksto( $option ) { if ( $this->parameters->getParameter( 'distinct' ) == 'strict' ) { $this->addGroupBy( 'page_title' ); } if ( count( $option ) ) { $where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['pagelinks'] . '.pl_from FROM ' . $this->tableNames...
Class
2
public static function getStylesheet($styleName) { // Get custom stylesheet, of the default stylesheet if the custom stylesheet does not exist $stylesheet = get_option($styleName, ''); if (strlen($stylesheet) <= 0) { $stylesheetFile = SlideshowPluginMain::getPluginPath() . DIRECTORY_SEPARATOR . 'style' . ...
Class
2
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 { ...
Class
2
public function showUnpublished() { expHistory::set('viewable', $this->params); // setup the where clause for looking up records. $where = parent::aggregateWhereClause(); $where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where; ...
Base
1
public function testSetSaveHandler54() { $this->iniSet('session.save_handler', 'files'); $storage = $this->getStorage(); $storage->setSaveHandler(); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); ...
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
public function pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::ge...
Base
1
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_templates WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bind...
Base
1
public function addTab($array) { if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $array = $this->checkKeys($this->getTableColumnsFormatted('tabs'), $array); $array['group_id'] = ($array['group_id']) ?? $this->getDefaultGroupId(); $array['category_id'] = ($array['...
Base
1
private function checkResponse ($string) { if (substr($string, 0, 3) !== '+OK') { $this->error = array( 'error' => "Server reported an error: $string", 'errno' => 0, 'errstr' => '' ); if ($this->do_debug >= 1) { $this->displayErrors(); } return false...
Base
1
public function delete() { global $user; $count = $this->address->find('count', 'user_id=' . $user->id); if($count > 1) { $address = new address($this->params['id']); if ($user->isAdmin() || ($user->id == $address->user_id)) { if ($address->is_bill...
Base
1
function insertObject($object, $table) { //if ($table=="text") eDebug($object,true); $sql = "INSERT INTO `" . $this->prefix . "$table` ("; $values = ") VALUES ("; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an ...
Base
1
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
Class
2
protected function fsock_get_contents( &$url, $timeout, $redirect_max, $ua, $outfp ) { $connect_timeout = 3; $connect_try = 3; $method = 'GET'; $readsize = 4096; $getSize = null; $headers = ''; $arr = parse_url($url); if (!$arr){ // Bad request return false; } // query $arr['query']...
Base
1
private function updateModificationDate() { try { $modif_date = date('Y-m-d'); $update = $this->zdb->update(self::TABLE); $update->set( array('date_modif_adh' => $modif_date) )->where(self::PK . '=' . $this->_id); $edit = $this...
Base
1
static function author() { return "Dave Leffler"; }
Base
1
protected function parseRaw($raw, $base, $nameOnly = false) { $info = preg_split("/\s+/", $raw, 9); $stat = array(); if (!isset($this->ftpOsUnix)) { $this->ftpOsUnix = !preg_match('/\d/', substr($info[0], 0, 1)); } if (!$this->ftpOsUnix) { $info = $this->normalizeRawWindows($raw); } if (count($...
Base
1
public static function incFunc($var) { if (self::functionExist($var)) { include(GX_THEME.$var.'/function.php'); } }
Base
1
protected function getItemsInHand($hashes, $dir = null) { static $totalSize = 0; if (is_null($dir)) { $totalSize = 0; if (! $tmpDir = $this->getTempPath()) { return false; } $dir = tempnam($tmpDir, 'elf'); if (!unlink($dir) || !mkdir($dir, 0700, true)) { return false; } register_shutdo...
Base
1
public function destroy(PaymentMethod $paymentMethod) { $this->authorize('delete', $paymentMethod); $payments = $paymentMethod->payments; if ($payments->count() > 0) { return respondJson('payments_attached', 'Payments Attached.'); } $paymentMethod->delete()...
Class
2
$this->headers = ['host' => [$host]] + $this->headers;
Base
1
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( ...
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
protected function moveVotes() { $sql = "SELECT * FROM package_proposal_votes WHERE pkg_prop_id = {$this->proposal}"; $res = $this->mdb2->query($sql); if (MDB2::isError($res)) { throw new RuntimeException("DB error occurred: {$res->getDebugInfo()}"); } if ($re...
Base
1
public function actionEditDropdown() { $model = new Dropdowns; if (isset($_POST['Dropdowns'])) { $model = Dropdowns::model()->findByPk( $_POST['Dropdowns']['id']); if ($model->id == Actions::COLORS_DROPDOWN_ID) { if (AuxLib::issetIsArray($...
Class
2
function VerifyFixedSchedule($columns,$columns_var,$update=false) { $qr_teachers= DBGet(DBQuery('select TEACHER_ID,SECONDARY_TEACHER_ID from course_periods where course_period_id=\''.$_REQUEST['course_period_id'].'\'')); $teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHE...
Base
1
public function manage() { expHistory::set('manageable', $this->params); // build out a SQL query that gets all the data we need and is sortable. $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id '; $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_P...
Base
1
public function display_sdm_stats_meta_box($post) { //Stats metabox $old_count = get_post_meta($post->ID, 'sdm_count_offset', true); $value = isset($old_count) && $old_count != '' ? $old_count : '0'; // Get checkbox for "disable download logging" $no_logs = get_post_meta($post->ID, 'sdm_item_no_log', true); ...
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 getQueryGroupby() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return "$R2.id"; }
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']; ...
Class
2
function test_anon_comments_require_email() { add_filter( 'xmlrpc_allow_anonymous_comments', '__return_true' ); $comment_args = array( 1, '', '', self::$post->ID, array( 'author' => 'WordPress', 'author_email' => 'noreply at wordpress.org', 'content' => 'Test Anon Comments', ...
Class
2
function parse_request($message) { $data = _parse_message($message); $matches = []; if (!preg_match('/^[a-zA-Z]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { throw new \InvalidArgumentException('Invalid request string'); } $parts = explode(' ', $data['start-line'], 3); $v...
Base
1
public function save() { $data = $_POST['file']; // security (remove all ..) $data['name'] = str_replace('..', '', $data['name']); $file = FILES_DIR . DS . $data['name']; // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csr...
Class
2
protected function generateVerifyCode() { if ($this->minLength > $this->maxLength) { $this->maxLength = $this->minLength; } if ($this->minLength < 3) { $this->minLength = 3; } if ($this->maxLength > 20) { $this->maxLength = 20; ...
Class
2
protected function secure(Hostname $hostname, Request $request) { $this->emitEvent(new Secured($hostname)); return $this->redirect->secure($request->getRequestUri()); }
Base
1
function singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
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->...
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 { ...
Class
2
function update_optiongroup_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $og = new optiongroup_master($id); $oldtitle = $og->title; $og->update($this->params); // if the title of the master changed we should update th...
Base
1
protected function _tempdir($dir, $prefix = '', $mode = 0700) { if (substr($dir, -1) != DIRECTORY_SEPARATOR) { $dir .= DIRECTORY_SEPARATOR; } do { $path = $dir.$prefix.mt_rand(0, 9999999); } while (!mkdir($path, $mode)); return $path; }
Base
1
function mci_account_get_array_by_id( $p_user_id ) { $t_result = array(); $t_result['id'] = $p_user_id; if( user_exists( $p_user_id ) ) { $t_result['name'] = user_get_field( $p_user_id, 'username' ); $t_dummy = user_get_field( $p_user_id, 'realname' ); if( !empty( $t_dummy ) ) { $t_result['real_name'] = $...
Class
2
public function dispatch($messages, $final) { $targetErrors = []; foreach ($this->targets as $target) { if ($target->enabled) { try { $target->collect($messages, $final); } catch (\Exception $e) { $target->enable...
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_block_groups WHERE website = '.protect($website->id), 'object' ); $out = $DB->result...
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...
Class
2
public function delete() { global $db; /* 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']) ? COMMENTS_REQUIRE_LO...
Class
2
function OA_runMPE() { $objResponse = new xajaxResponse(); $objResponse->addAssign("run-mpe", "innerHTML", "<img src='run-mpe.php' />"); return $objResponse; }
Compound
4
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 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
private function __construct($userinfo, $tid = - 1) { $this->userinfo = $userinfo; $this->tid = $tid; // initialize data array $this->initData(); // read data from database $this->readData(); }
Class
2
$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