code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
public static function navtojson() { return json_encode(self::navhierarchy()); }
Class
2
public function check(&$params){ $tags = $this->config['options']['tags']['value']; $tags = is_array($tags) ? $tags : Tags::parseTags($tags, true); if(!empty($tags) && isset($params['tags'])){ // Check passed params to be sure they're set if(!is_array($params['tags'])){ ...
Class
2
public function setItemAttributes( $attributes ) { $this->itemAttributes = \Sanitizer::fixTagAttributes( $attributes, 'li' ); }
Class
2
public static function lib($var) { $file = GX_LIB.$var.'.class.php'; if (file_exists($file)) { include($file); } }
Base
1
$confirm_string .= tep_draw_hidden_field('chosen[]', $customer_id); } } else { $confirm_string .= tep_draw_hidden_field('global', 'true'); } $confirm_string .= tep_draw_bootstrap_button(IMAGE_SEND, 'fas fa-paper-plane', null, 'primary', null, 'btn-success btn-b...
Base
1
$name = ucfirst($module->name); if (in_array($name, $skipModules)) { continue; } if($name != 'Document'){ $controllerName = $name.'Controller'; if(file_exists('protected/modules/'.$module->name.'/controllers/'.$controllerNam...
Base
1
$cont_title = substr(Typo::Xclean(Typo::strip($data['posts'][0]->title)),0,$limit); $titlelength = strlen($data['posts'][0]->title); }else{
Base
1
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) { if ($is_revisioned) { $object->revision_id++; //if ($table=="text") eDebug($object); $res = $this->insertObject($object, $table); //if ($table=="text") eDebug($objec...
Class
2
public function searchNew() { global $db, $user; //$this->params['query'] = str_ireplace('-','\-',$this->params['query']); $sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, "; $sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "...
Base
1
public function twoFactorAuthenticationAction(Request $request) { $view = $this->buildLoginPageViewModel(); if ($request->hasSession()) { $session = $request->getSession(); $authException = $session->get(Security::AUTHENTICATION_ERROR); if ($authException ins...
Base
1
public function update() { //populate the alt tag field if the user didn't if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title']; // call expController update to save the image parent::update(); }
Base
1
$val = self::escape($val); $set .= "'{$val}',"; $k .= "`{$key}`,"; } $set = substr($set, 0,-1); $k = substr($k, 0,-1); $sql = sprintf("INSERT INTO `%s` (%s) VALUES (%s) ", $vars['table'], $k...
Base
1
public function testUriEncodesPathProperly($input, $output) { $uri = new Uri($input); $this->assertEquals((string) $uri, $output); }
Base
1
public function regenerate($destroy = false, $lifetime = null) { // Cannot regenerate the session ID for non-active sessions. if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE !== session_status()) { return false; } // Check if session ID exists in PHP 5.3 i...
Base
1
public function rules() { return [ 'name' => 'required', 'email' => 'required|email', 'address' => '', 'primary_number' => 'numeric', 'secondary_number' => 'numeric', 'password' => 'sometimes', 'password_confirmation' =>...
Class
2
function singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
Base
1
. "Stack trace:\n" . $exception->getTraceAsString(); } else { $message = 'Error: ' . $exception->getMessage(); } return $message; }
Base
1
public function confirm() { global $db; // 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->params['id'])) expQueue::flashAndFlow('error', gt('The subscrib...
Class
2
protected function connect() { if (!($this->connect = @ftp_connect($this->options['host'], $this->options['port'], $this->options['timeout']))) { return $this->setError('Unable to connect to FTP server '.$this->options['host']); } if (!@ftp_login($this->connect, $this->options['user'], $this->options['pass'])...
Base
1
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
public static function loadFieldType(Db $zdb, $id) { try { $select = $zdb->select(self::TABLE); $select->where('field_id = ' . $id); $results = $zdb->execute($select); $result = $results->current(); if ($result) { $field_type =...
Base
1
$item = trim( $item ); if ( strpos( $item, '|-' ) === 0 ) { $item = explode( '|-', $item, 2 ); if ( count( $item ) == 2 ) { $item = $item[1]; } else { $rowsKey[$index] = $item; continue; } } if ( strlen( $item ) > 0 ) { $word = explode( "\n|", $item ); if ...
Class
2
function selectObjectBySql($sql) { //$logFile = "C:\\xampp\\htdocs\\supserg\\tmp\\queryLog.txt"; //$lfh = fopen($logFile, 'a'); //fwrite($lfh, $sql . "\n"); //fclose($lfh); $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($re...
Base
1
function reparent_standalone() { $standalone = $this->section->find($this->params['page']); if ($standalone) { $standalone->parent = $this->params['parent']; $standalone->update(); expSession::clearAllUsersSessionCache('navigation'); expHistory::...
Base
1
$_result[$_key] = preg_replace("/<>'\"\[\]{}:;/", "", $_value); } $result = $_result; } else { $_result = strip_tags($arr[$key]); $result = preg_replace("/<>'\"\[\]{}:;/", "", $_result); } } else { $result = $def; } r...
Base
1
public function getRecordTitle($id) { if (isset($this->faqRecord['id']) && ($this->faqRecord['id'] == $id)) { return $this->faqRecord['title']; } $question = ''; $query = sprintf( "SELECT thema AS question FROM ...
Base
1
public function showall_tags() { $images = $this->image->find('all'); $used_tags = array(); foreach ($images as $image) { foreach($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count++; } else...
Class
2
public function search($q, $page=''){ $q = str_replace(' ', '+', trim($q)); if(isset($page) && $page !=''){ $page = "&page=".$page; }else{ $page = ""; } $url = "http://api.themoviedb.org/3/search/movie?query=".$q."&api_key=".$this->apikey.$page;...
Base
1
function configure() { expHistory::set('editable', $this->params); // little bit of trickery so that that categories can have their own configs $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $pu...
Base
1
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 confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $swimlane, ))); }
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 static function post($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".self::slug($vars)."/{$vars}"; break; default: # code... $url = Options::get('...
Compound
4
public function __construct() { }
Base
1
public function beforeSave() { if(strpos($this->tag,self::DELIM) !== false) { $this->tag = strtr($this->tag,array(self::DELIM => '')); } return true; }
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
unset($map[$n], $n, $d); } unset($map); if(!self::$client) { self::$client = false; } } }
Base
1
public function actionAppendTag() { if (isset($_POST['Type'], $_POST['Id'], $_POST['Tag']) && preg_match('/^[\w\d_-]+$/', $_POST['Type'])) { if (!class_exists($_POST['Type'])) { echo 'false'; return; } $model = X2Model::mod...
Class
2
public function save($check_notify = false) { if (isset($_POST['email_recipients']) && is_array($_POST['email_recipients'])) { $this->email_recipients = base64_encode(serialize($_POST['email_recipients'])); } return parent::save($check_notify); }
Base
1
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
Base
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
function XMLRPCremoveNode($nodeID){ require_once(".ht-inc/privileges.php"); global $user; if(!in_array("nodeAdmin", $user['privileges'])){ return array( 'status' => 'error', 'errorcode' => 56, 'errormsg' => 'User cannot administer nodes'); } if(!checkUserH...
Class
2
public static function totalPost($vars) { $posts = Db::result("SELECT `id` FROM `posts` WHERE `type` = '{$vars}'"); $npost = Db::$num_rows; return $npost; }
Base
1
public function testAuthCheckAuthFails() { $GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey'; $GLOBALS['server'] = 1; $_REQUEST['old_usr'] = ''; $_REQUEST['pma_username'] = ''; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pmaUs...
Class
2
private function dumpParameter($name) { if ($this->container->isCompiled() && $this->container->hasParameter($name)) { $value = $this->container->getParameter($name); $dumpedValue = $this->dumpValue($value, false); if (!$value || !\is_array($value)) { ...
Base
1
function verify(){ echo $_GET['challenge']; }
Base
1
$property->value[$lang] = theme::import_sample_translate_nv_urls($pvalue, $structure, $items); } } else if(!is_string($property->value)) // ignore numeric values { $property->val...
Base
1
public function index($id) { $this->paginate['conditions'] = array('GalaxyElement.galaxy_cluster_id' => $id); $clusters = $this->paginate(); $this->set('list', $clusters); if ($this->request->is('ajax')) { $this->layout = 'ajax'; $this->render('ajax/index'...
Class
2
} elseif ($type == 'customlayout') { $layoutData = unserialize($data['name']); $className = $layoutData['className']; $layoutName = $layoutData['name']; if ($item['name'] == $layoutName && $item['className'] == $className) { ...
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
public function actionAppendTag() { if (isset($_POST['Type'], $_POST['Id'], $_POST['Tag']) && preg_match('/^[\w\d_-]+$/', $_POST['Type'])) { if (!class_exists($_POST['Type'])) { echo 'false'; return; } $model = X2Model::mod...
Base
1
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
function _makeChooseCheckbox($value, $title) { global $THIS_RET; // return '<INPUT type=checkbox name=st_arr[] value=' . $value . ' checked>'; return "<input name=unused[$THIS_RET[STUDENT_ID]] value=" . $THIS_RET[STUDENT_ID] . " type='checkbox' id=$THIS_RET[STUDENT_ID] onClick='setHiddenCheckboxStudent...
Base
1
public function print_form() { global $user_id; include_once( GEO_MASHUP_DIR_PATH . '/edit-form.php'); if ( isset( $_GET['user_id'] ) ) { $object_id = $_GET['user_id']; } else { $object_id = $user_id; } echo '<h3>' . __( 'Location', 'GeoMashup' ) . '</h3>'; geo_mashup_edit_form( 'user', ...
Class
2
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
Base
1
protected function assetExtensions() { return [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'ico', 'css', 'js', 'woff', 'woff2', 'svg', 'ttf', ...
Base
1
public function save() { session_write_close(); if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { // This condition matches only PHP 5.3 with internal save handlers $this->saveHandler->setActive(false); } $this->...
Base
1
public function test_valid_comment_0_content() { $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => '0', ), ) ); $this->assertNotIXRError( $result ); }
Class
2
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...
Base
1
public function getDisplayName ($plural=true) { return Yii::t('users', '{user}', array( '{user}' => Modules::displayName($plural, 'Users'), )); }
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 save_user() { if ( empty( $_POST['user_id'] ) ) { return false; } $user_id = $_POST['user_id']; if ( !is_numeric( $user_id ) ) { return $user_id; } if ( !current_user_can( 'edit_user', $user_id ) ) { return $user_id; } return $this->save_posted_object_locatio...
Class
2
function delete() { global $db; if (empty($this->params['id'])) return false; $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']); $product = new $product_type($this->params['id'], true, false); //eDebug($product_type); //eDebug...
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...
Base
1
public function testDeleteTemplateAction() { $client = $this->getClientForAuthenticatedUser(User::ROLE_ADMIN); $fixture = new InvoiceTemplateFixtures(); $template = $this->importFixture($fixture); $id = $template[0]->getId(); $this->request($client, '/invoice/template/'...
Compound
4
public function batUpdate(){ $cats = I("cats"); $item_id = I("item_id/d"); $login_user = $this->checkLogin(); if (!$this->checkItemEdit($login_user['uid'] , $item_id)) { $this->sendError(10103); return ; } $ret = ''; $data_array = json_...
Compound
4
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
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
protected function gdImageCreate($path,$mime){ switch($mime){ case 'image/jpeg': return @imagecreatefromjpeg($path); case 'image/png': return @imagecreatefrompng($path); case 'image/gif': return @imagecreatefromgif($path); case 'image/x-ms-bmp': if (!function_exists('imagecreatefrombmp')) ...
Base
1
public function getBoolean($key, $default = false, $deep = false) { return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN, array(), $deep); }
Base
1
function update() { parent::update(); expSession::clearAllUsersSessionCache('navigation'); }
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
private function getProjectForUser($id) { $project = $this->project_manager->getProject($id); $user = $this->user_manager->getCurrentUser(); ProjectAuthorization::userCanAccessProject($user, $project, new URLVerification()); return $project; }
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
public function deleteCommentAction(CustomerComment $comment) { $customerId = $comment->getCustomer()->getId(); try { $this->repository->deleteComment($comment); } catch (\Exception $ex) { $this->flashDeleteException($ex); } return $this->redirec...
Compound
4
public function pinCommentAction(CustomerComment $comment) { $comment->setPinned(!$comment->isPinned()); try { $this->repository->saveComment($comment); } catch (\Exception $ex) { $this->flashUpdateException($ex); } return $this->redirectToRoute('...
Compound
4
self::$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); return self::$mysqli; } }
Compound
4
public function crossOriginRedirectProvider() { return [ ['http://example.com?a=b', 'http://test.com/', false], ['https://example.com?a=b', 'https://test.com/', false], ['http://example.com?a=b', 'https://test.com/', false], ['https://example.com?a=b', 'ht...
Class
2
public static function countries_regions($country_id="") { global $DB; // note: regions have no translation to any language right now $country_query = " 1=1 "; if(!empty($country_id)) $country_query = ' AND r.country = '.protect($country_id); $DB->query(' SE...
Base
1
public function settings() { AuthUser::load(); if (!AuthUser::isLoggedIn()) { redirect(get_url('login')); } else if (!AuthUser::hasPermission('admin_edit')) { Flash::set('error', __('You do not have permission to access the requested page!')); redirect(get...
Class
2
foreach ($events as $event) { $extevents[$date][] = $event; }
Class
2
protected function emailExistsInDB($email) { /* Build sql query*/ $sql = 'SELECT * FROM '.$this->usersTable; $sql .= ' WHERE email = "'.$email.'";'; /* Execute query */ $results = $this->wiki->loadAll($sql); return $results; // If the password does not already ex...
Base
1
function send_feedback() { $success = false; if (isset($this->params['id'])) { $ed = new eventdate($this->params['id']); // $email_addrs = array(); if ($ed->event->feedback_email != '') { $msgtemplate = expTemplate::get_template_for_action($th...
Class
2
protected function connect() { if ($this->connection and $this->connection->isValid()) { return; } $command = sprintf('%s --authentication-file=/proc/self/fd/3 //%s/%s', Server::CLIENT, $this->server->getHost(), $this->name ); $this->connection = new Connection($command); $this->connection->wri...
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...
Base
1
$files[$i] = '.' . DIRECTORY_SEPARATOR . basename($file); } $files = array_map('escapeshellarg', $files); $cmd = $arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . implode(' ', $files); $err_out = ''; ...
Base
1
public function remove(History $hist, $transaction = true) { global $emitter; try { if ($transaction) { $this->zdb->connection->beginTransaction(); } //remove associated contributions if needeed if ($this->getDispatchedAmount() > ...
Base
1
public static function getDefaultLang() { $def = Options::v('multilang_default'); $lang = json_decode(Options::v('multilang_country'), true); $deflang = $lang[$def]; return $deflang; }
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($...
Class
2
public static function json() { $token = Options::v('tokens'); $token = json_decode($token, true); $newtoken = array( TOKEN => array( 'time' => TOKEN_TIME, 'ip' => TOKEN_IP, 'ur...
Base
1
protected function initServiceMode($request) { $config = $this->Application()->Config(); if (!empty($config->setOffline) && strpos($config->offlineIp, $request->getClientIp()) === false) { if ($request->getControllerName() !== 'error') { $request->setControllerName('e...
Base
1
public function __construct () { self::$myBlogName = Options::v('sitename'); self::$myBlogUrl = Options::v('siteurl'); self::$myBlogUpdateUrl = Options::v('siteurl'); self::$myBlogRSSFeedUrl = Url::rss(); }
Base
1
function formatValue( $name, $value ) { $row = $this->mCurrentRow; $wiki = $row->files_dbname; switch ( $name ) { case 'files_timestamp': $formatted = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $row->files_timestamp, $this->getUser() ) ); break; case 'files_dbname': $formatted =...
Class
2
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
Base
1
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 reparent_standalone() { $standalone = $this->section->find($this->params['page']); if ($standalone) { $standalone->parent = $this->params['parent']; $standalone->update(); expSession::clearAllUsersSessionCache('navigation'); expHistory::...
Class
2
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(); /...
Base
1
function verify(){ echo $_GET['challenge']; }
Base
1
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
Base
1