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'])){ $params['tags'] = explode(',', $params['tags']); } $params['tags'] = array_map(function($item){ return preg_replace('/^#/','', $item); }, $params['tags']); // must have at least 1 tag in the list: if(count(array_intersect($params['tags'], $tags)) > 0){ return $this->checkConditions($params); }else{ return array(false, Yii::t('studio','No tags on the record matched those in the tag trigger criteria.')); } }else{ // config is invalid or record has no tags (tags are not optional) return array(false, empty($tags) ? Yii::t('studio','No tags in the trigger criteria!') : Yii::t('studio','Tags parameter missing!')); } }
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-block btn-lg'); $confirm_string .= '</form>'; } $confirm_string .= tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-angle-left', tep_href_link('newsletters.php', 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=send'), 'primary', null, 'btn-light mt-2'); return $confirm_string; }
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/'.$controllerName.'.php')){ Yii::import("application.modules.$module->name.controllers.$controllerName"); $controller = new $controllerName($controllerName); $model = $controller->modelClass; if(class_exists($model)){ $moduleList[$model] = Yii::t('app', $module->title); } } } } return $moduleList; }
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($object,true); $this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT); return $res; } $sql = "UPDATE " . $this->prefix . "$table SET "; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' //if($is_revisioned && $var=='revision_id') $val++; if ($var{0} != '_') { if (is_array($val) || is_object($val)) { $val = serialize($val); $sql .= "`$var`='".$val."',"; } else { $sql .= "`$var`='" . $this->escapeString($val) . "',"; } } } $sql = substr($sql, 0, -1) . " WHERE "; if ($where != null) $sql .= $this->injectProof($where); else $sql .= "`" . $identifier . "`=" . $object->$identifier; //if ($table == 'text') eDebug($sql,true); $res = (@mysqli_query($this->connection, $sql) != false); return $res; }
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'] . "*' IN BOOLEAN MODE) as relevance, "; $sql .= "CASE when p.model like '" . $this->params['query'] . "%' then 1 else 0 END as modelmatch, "; $sql .= "CASE when p.title like '%" . $this->params['query'] . "%' then 1 else 0 END as titlematch "; $sql .= "from " . $db->prefix . "product as p INNER JOIN " . $db->prefix . "content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN " . $db->prefix . "expFiles as f ON cef.expFiles_id = f.id WHERE "; if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND '; $sql .= " match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) AND p.parent_id=0 "; $sql .= " HAVING relevance > 0 "; //$sql .= "GROUP BY p.id "; $sql .= "order by modelmatch,titlematch,relevance desc LIMIT 10"; eDebug($sql); $res = $db->selectObjectsBySql($sql); eDebug($res, true); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
Base
1
public function twoFactorAuthenticationAction(Request $request) { $view = $this->buildLoginPageViewModel(); if ($request->hasSession()) { $session = $request->getSession(); $authException = $session->get(Security::AUTHENTICATION_ERROR); if ($authException instanceof AuthenticationException) { $session->remove(Security::AUTHENTICATION_ERROR); $view->error = $authException->getMessage(); } } else { $view->error = 'No session available, it either timed out or cookies are not enabled.'; } return $view; }
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, $set) ; }else{ $sql = $vars; } if(DB_DRIVER == 'mysql') { mysql_query('SET CHARACTER SET utf8'); $q = mysql_query($sql) or die(mysql_error()); self::$last_id = mysql_insert_id(); }elseif(DB_DRIVER == 'mysqli'){ try { if(!self::query($sql)){ // printf("<div class=\"alert alert-danger\">Errormessage: %s</div>\n", self::$mysqli->error); //Control::error('db',self::$mysqli->error); return false; }else{ self::$last_id = self::$mysqli->insert_id; return true; } } catch (exception $e) { echo $e->getMessage(); } } //return true; }
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 if (PHP_VERSION_ID < 50400 && '' === session_id()) { return false; } if (null !== $lifetime) { ini_set('session.cookie_lifetime', $lifetime); } if ($destroy) { $this->metadataBag->stampNew(); } $isRegenerated = session_regenerate_id($destroy); // The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it. // @see https://bugs.php.net/bug.php?id=70013 $this->loadSession(); return $isRegenerated; }
Base
1
public function rules() { return [ 'name' => 'required', 'email' => 'required|email', 'address' => '', 'primary_number' => 'numeric', 'secondary_number' => 'numeric', 'password' => 'sometimes', 'password_confirmation' => 'sometimes', 'image_path' => '', 'departments' => 'required' ]; }
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 subscriber id for account was not supplied.')); // verify the id/key pair $id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash="'.$this->params['key'].'"'); if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.')); // activate this users pending subscriptions $sub = new stdClass(); $sub->enabled = 1; $db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id); // find the users active subscriptions $ealerts = expeAlerts::getBySubscriber($id); assign_to_template(array( 'ealerts'=>$ealerts )); }
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'])) { $this->umount(); return $this->setError('Unable to login into '.$this->options['host']); } // try switch utf8 mode if ($this->encoding) { @ftp_exec($this->connect, 'OPTS UTF8 OFF'); } else { @ftp_exec($this->connect, 'OPTS UTF8 ON' ); } // switch off extended passive mode - may be usefull for some servers @ftp_exec($this->connect, 'epsv4 off' ); // enter passive mode if required $pasv = ($this->options['mode'] == 'passive'); if (! ftp_pasv($this->connect, $pasv)) { if ($pasv) { $this->options['mode'] = 'active'; } } // enter root folder if (! @ftp_chdir($this->connect, $this->root) || $this->root != @ftp_pwd($this->connect)) { $this->umount(); return $this->setError('Unable to open root folder.'); } // check for MLST support $features = ftp_raw($this->connect, 'FEAT'); if (!is_array($features)) { $this->umount(); return $this->setError('Server does not support command FEAT.'); } foreach ($features as $feat) { if (strpos(trim($feat), 'MLST') === 0) { $this->MLSTsupprt = true; break; } } return true; }
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 = $result->field_type; $field_type = self::getFieldType($zdb, $field_type); $field_type->loadFromRs($result); return $field_type; } } catch (Throwable $e) { Analog::log( __METHOD__ . ' | Unable to retrieve field `' . $id . '` information | ' . $e->getMessage(), Analog::ERROR ); return false; } return false; }
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 ( isset( $word[0] ) && empty( $word[0] ) ) { array_shift( $word ); } if ( isset( $word[abs( $sortColumn ) - 1] ) ) { $test = trim( $word[abs( $sortColumn ) - 1] ); if ( strpos( $test, '|' ) > 0 ) { $test = trim( explode( '|', $test )[1] ); } $rowsKey[$index] = $test; } } } $this->sort($rowsKey, $sortColumn); $newItems = []; foreach ( $rowsKey as $index => $val ) { $newItems[] = $items[$index]; } $items = $newItems; } return $this->listStart . $this->implodeItems( $items ) . $this->listEnd; }
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 ($res == null) return null; return mysqli_fetch_object($res); }
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::back(); } else { notfoundController::handle_not_found(); } }
Base
1
$_result[$_key] = preg_replace("/<>'\"\[\]{}:;/", "", $_value); } $result = $_result; } else { $_result = strip_tags($arr[$key]); $result = preg_replace("/<>'\"\[\]{}:;/", "", $_result); } } else { $result = $def; } return $result; }
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 %sfaqdata WHERE id = %d AND lang = '%s'", PMF_Db::getTablePrefix(), $id, $this->_config->getLanguage()->getLanguage() ); $result = $this->_config->getDb()->query($query); if ($this->_config->getDb()->numRows($result) > 0) { while ($row = $this->_config->getDb()->fetchObject($result)) { $question = $row->question; } } else { $question = $this->pmf_lang['no_cats']; } return $question; }
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 { $exptag = new expTag($tag->id); $used_tags[$tag->id] = $exptag; $used_tags[$tag->id]->count = 1; } } } assign_to_template(array( 'tags'=>$used_tags )); }
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; $search = $this->curl($url); //echo $search; return $search; }
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; $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc); $views = expTemplate::get_config_templates($this, $this->loc); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all'); assign_to_template(array( 'config'=>$this->config, 'pullable_modules'=>$pullable_modules, 'views'=>$views, 'countries'=>$countries, 'regions'=>$regions, 'title'=>static::displayname() )); }
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_creation/event', array( 'values' => $values, 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
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, 'project' => $project, ))); }
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('siteurl')."/index.php?post={$vars}"; break; } return $url; }
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)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); } return $ret; }
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 $key=>$d) { if ($d->id == $this->params['date_id']) $event_key = $key; } assign_to_template(array( 'allforms' => array_merge($allforms, expTemplate::buildNameList("forms", "event/email", "tpl", "[!_]*")), 'checked_date' => !empty($this->params['date_id']) ? $this->params['date_id'] : null, 'event_key' => $event_key, )); }
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::model($_POST['Type'])->findByPk($_POST['Id']); echo $model->addTags($_POST['Tag']); exit; if ($model !== null && $model->addTags($_POST['Tag'])) { echo 'true'; return; } } echo 'false'; }
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(!checkUserHasPriv("nodeAdmin", $user['id'], $nodeID)){ return array( 'status' => 'error', 'errorcode' => 57, 'errormsg' => 'User cannot edit this node'); } $nodes = recurseGetChildren($nodeID); array_push($nodes, $nodeID); $deleteNodes = implode(',', $nodes); $query = "DELETE FROM privnode " . "WHERE id IN ($deleteNodes)"; doQuery($query, 345); return array( 'status' => 'success'); }
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'] = 'pmaUser1'; $_COOKIE['pma_iv-1'] = base64_encode('testiv09testiv09'); $GLOBALS['cfg']['blowfish_secret'] = 'secret'; $_SESSION['last_access_time'] = 1; $_SESSION['last_valid_captcha'] = true; $GLOBALS['cfg']['LoginCookieValidity'] = 0; $_SESSION['last_access_time'] = -1; // mock for blowfish function $this->object = $this->getMockBuilder('AuthenticationCookie') ->disableOriginalConstructor() ->setMethods(array('authFails')) ->getMock(); $this->object->expects($this->once()) ->method('authFails'); $this->assertFalse( $this->object->authCheck() ); $this->assertTrue( $GLOBALS['no_activity'] ); }
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)) { return $dumpedValue; } if (!preg_match("/\\\$this->(?:getEnv\('(?:\w++:)*+\w++'\)|targetDirs\[\d++\])/", $dumpedValue)) { return sprintf("\$this->parameters['%s']", $name); } } return sprintf("\$this->getParameter('%s')", $name); }
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->value = theme::import_sample_translate_nv_urls($property->value, $structure, $items); } } $el_properties_associative[$property->id] = $property->value; } if(!empty($el_properties_associative)) { if($el=='block_group_block') { $template = $real[$el_id]->code; } else if($el=='block') { $template = $real[$el_id]->type; } else { $template = $real[$el_id]->template; if(empty($template) && $el == 'item' && $real[$el_id]->embedding == 1) { // we have to get the template set in the category of the item $template = $DB->query_single( 'template', 'nv_structure', ' id = '.protect($real[$el_id]->category).' AND website = '.$ws->id ); } } property::save_properties_from_array($el, $real[$el_id]->id, $template, $el_properties_associative, $ws, $item_uid); } }
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) { $class = DataObject\ClassDefinition::getByName($className); if (!$class) { throw new \Exception('Class does not exist'); } $classId = $class->getId(); $layoutList = new DataObject\ClassDefinition\CustomLayout\Listing(); $db = \Pimcore\Db::get(); $layoutList->setCondition('name = ' . $db->quote($layoutName) . ' AND classId = ' . $classId); $layoutList = $layoutList->load(); $layoutDefinition = null; if ($layoutList) { $layoutDefinition = $layoutList[0]; } if (!$layoutDefinition) { $layoutDefinition = new DataObject\ClassDefinition\CustomLayout(); $layoutDefinition->setName($layoutName); $layoutDefinition->setClassId($classId); } try { $layoutDefinition->setDescription($item['description']); $layoutDef = DataObject\ClassDefinition\Service::generateLayoutTreeFromArray($item['layoutDefinitions'], true); $layoutDefinition->setLayoutDefinitions($layoutDef); $layoutDefinition->save(); } catch (\Exception $e) { Logger::error($e->getMessage()); return $this->adminJson(['success' => false, 'message' => $e->getMessage()]); } } } } return $this->adminJson(['success' => true]); }
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::model($_POST['Type'])->findByPk($_POST['Id']); echo $model->addTags($_POST['Tag']); exit; if ($model !== null && $model->addTags($_POST['Tag'])) { echo 'true'; return; } } echo 'false'; }
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 = str_replace("�", "-", $str); $str = str_replace("�", "&#151;", $str); $str = str_replace("�", "&rdquo;", $str); $str = str_replace("�", "&ldquo;", $str); $str = str_replace("\r\n", " ", $str); $str = str_replace("\,", ",", $str); $str = str_replace('""', '"', $str); //do this no matter what...in case someone added a quote in a non HTML field if (!$isHTML) { //if HTML, then leave the single quotes alone, otheriwse replace w/ special Char $str = str_replace('"', "&quot;", $str); } $str = str_replace("�", "&#188;", $str); $str = str_replace("�", "&#189;", $str); $str = str_replace("�", "&#190;", $str); //$str = htmlspecialchars($str); //$str = utf8_encode($str); // if (DB_ENGINE=='mysqli') { // $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "&trade;", $str))); // } elseif(DB_ENGINE=='mysql') { // $str = @mysql_real_escape_string(trim(str_replace("�", "&trade;", $str)),$db->connection); // } else { // $str = trim(str_replace("�", "&trade;", $str)); // } $str = @expString::escape(trim(str_replace("�", "&trade;", $str))); //echo "2<br>"; eDebug($str,die); return $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='setHiddenCheckboxStudents(\"st_arr[]\",this,$THIS_RET[STUDENT_ID]);' />"; }
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', $object_id, get_class( $this ) ); }
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', 'eot', 'json', 'md', 'less', 'sass', 'scss', 'xml' ]; }
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->closed = true; $this->started = false; }
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'] == 'showall_tabbed')) { $limit = '0'; } $order = isset($this->config['order']) ? $this->config['order'] : "rank"; $page = new expPaginator(array( 'model'=>'photo', 'where'=>$this->aggregateWhereClause(), 'limit'=>$limit, 'order'=>$order, 'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'], 'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'), 'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']), 'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null, 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title' ), )); assign_to_template(array( 'page'=>$page, 'params'=>$this->params, )); }
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->flash->failure(t('Unable to remove this category.')); } $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); }
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_location( $user_id ); }
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($product, true); //if (!empty($product->product_type_id)) { //$db->delete($product_type, 'id='.$product->product_id); //} $db->delete('option', 'product_id=' . $product->id . " AND optiongroup_id IN (SELECT id from " . $db->prefix . "optiongroup WHERE product_id=" . $product->id . ")"); $db->delete('optiongroup', 'product_id=' . $product->id); //die(); $db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type="' . $product_type . '"'); if ($product->product_type == "product") { if ($product->hasChildren()) { $this->deleteChildren(); } } $product->delete(); flash('message', gt('Product deleted successfully.')); expHistory::back(); }
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( 'calculator'=>$calc )); }
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/' . $id . '/delete'); $this->assertIsRedirect($client, '/invoice/template'); $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); $this->assertHasFlashSuccess($client); $this->assertEquals(0, $this->getEntityManager()->getRepository(InvoiceTemplate::class)->count([])); }
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_decode(htmlspecialchars_decode($cats) , true) ; if ($data_array) { foreach ($data_array as $key => $value) { if ($value['cat_name']) { $ret = D("Catalog")->where(" cat_id = '%d' and item_id = '%d' ",array($value['cat_id'],$item_id) )->save(array( "cat_name" => $value['cat_name'] , "parent_cat_id" => $value['parent_cat_id'] , "level" => $value['level'] , "s_number" => $value['s_number'] , )); } if ($value['page_id'] > 0) { $ret = D("Page")->where(" page_id = '%d' and item_id = '%d' " ,array($value['page_id'],$item_id) )->save(array( "cat_id" => $value['parent_cat_id'] , "s_number" => $value['s_number'] , )); } } } $this->sendResult(array()); }
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, -1) == '=') { $value = ' IS NULL'; $string = substr($string, 0, -1); } $string .= "$value"; if ($counter == ($array_count - 2) && $array_count % 2 == 0) $string .= " ELSE "; elseif ($counter == ($array_count - 1)) $string .= " END "; elseif ($counter % 2 == 0) $string .= " WHEN $array[0]="; elseif ($counter % 2 == 1) $string .= " THEN "; $counter++; } } return $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')) { include_once dirname(__FILE__).'/libs/GdBmp.php'; } return @imagecreatefrombmp($path); case 'image/xbm': return @imagecreatefromxbm($path); case 'image/xpm': return @imagecreatefromxpm($path); } return false; }
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(); } if ($this->tagModel->remove($tag_id)) { $this->flash->success(t('Tag removed successfully.')); } else { $this->flash->failure(t('Unable to remove this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); }
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 if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
Base
1
public function deleteCommentAction(CustomerComment $comment) { $customerId = $comment->getCustomer()->getId(); try { $this->repository->deleteComment($comment); } catch (\Exception $ex) { $this->flashDeleteException($ex); } return $this->redirectToRoute('customer_details', ['id' => $customerId]); }
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('customer_details', ['id' => $comment->getCustomer()->getId()]); }
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', 'http://test.com/', false], ['http://example.com?a=b', 'http://example.com/', true], ['https://example.com?a=b', 'https://example.com/', true], ['http://example.com?a=b', 'https://example.com/', true], ['https://example.com?a=b', 'http://example.com/', false], ]; }
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(' SELECT r.`numeric` AS region_id, c.country_code, r.name FROM nv_countries c, nv_countries_regions r WHERE c.lang = "en" AND c.`numeric` = r.country AND r.lang = "" AND '.$country_query.' ORDER BY name ASC '); $rs = $DB->result(); return $rs; }
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_url()); } $settings = Plugin::getAllSettings('file_manager'); if (!$settings) { Flash::set('error', 'Files - ' . __('unable to retrieve plugin settings.')); return; } $this->display('file_manager/views/settings', array('settings' => $settings)); }
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 exist in DB, $result is an empty table => false }
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($this, 'email/_' . $this->params['formname'], $this->loc); $msgtemplate->assign('params', $this->params); $msgtemplate->assign('event', $ed); $email_addrs = explode(',', $ed->event->feedback_email); //This is an easy way to remove duplicates $email_addrs = array_flip(array_flip($email_addrs)); $email_addrs = array_map('trim', $email_addrs); $mail = new expMail(); $success += $mail->quickSend(array( "text_message" => $msgtemplate->render(), 'to' => $email_addrs, 'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS), 'subject' => $this->params['subject'], )); } } if ($success) { flashAndFlow('message', gt('Your feedback was successfully sent.')); } else { flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.')); } }
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->writeAuthentication($this->server->getUser(), $this->server->getPassword()); if (!$this->connection->isValid()) { throw new ConnectionException(); } }
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 $key=>$d) { if ($d->id == $this->params['date_id']) $event_key = $key; } assign_to_template(array( 'allforms' => array_merge($allforms, expTemplate::buildNameList("forms", "event/email", "tpl", "[!_]*")), 'checked_date' => !empty($this->params['date_id']) ? $this->params['date_id'] : null, 'event_key' => $event_key, )); }
Base
1
$files[$i] = '.' . DIRECTORY_SEPARATOR . basename($file); } $files = array_map('escapeshellarg', $files); $cmd = $arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . implode(' ', $files); $err_out = ''; $this->procExec($cmd, $o, $c, $err_out, $dir); chdir($cwd); } else { return false; } } $path = $dir . DIRECTORY_SEPARATOR . $name; return file_exists($path) ? $path : false; }
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() > 0) { $c = new Contributions($this->zdb, $this->login); $clist = $c->getListFromTransaction($this->_id); $cids = array(); foreach ($clist as $cid) { $cids[] = $cid->id; } $rem = $c->remove($cids, $hist, false); } //remove transaction itself $delete = $this->zdb->delete(self::TABLE); $delete->where( self::PK . ' = ' . $this->_id ); $del = $this->zdb->execute($delete); if ($del->count() > 0) { $this->dynamicsRemove(true); } else { Analog::log( 'Transaction has not been removed!', Analog::WARNING ); return false; } if ($transaction) { $this->zdb->connection->commit(); } $emitter->emit('transaction.remove', $this); return true; } catch (Throwable $e) { if ($transaction) { $this->zdb->connection->rollBack(); } Analog::log( 'An error occurred trying to remove transaction #' . $this->_id . ' | ' . $e->getMessage(), Analog::ERROR ); throw $e; } }
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($router->current_url, 'action=manage') !== false) { if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) { foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; } } } return false; }
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, 'url' => TOKEN_URL ) ); if(is_array($token)){ $newtoken = array_merge($token, $newtoken); } $newtoken = self::ridOld($newtoken); $newtoken = json_encode($newtoken); return $newtoken; }
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('error')->setActionName('service')->setDispatched(false); } } }
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 = $row->files_dbname; break; case 'files_url': $formatted = "<img src=\"{$row->files_url}\" style=\"width:135px;height:135px;\">"; break; case 'files_name': $formatted = "<a href=\"{$row->files_page}\">{$row->files_name}</a>"; break; case 'files_user': $formatted = "<a href=\"/wiki/Special:CentralAuth/{$row->files_user}\">{$row->files_user}</a>"; break; default: $formatted = "Unable to format $name"; break; } return $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 stored XSS security issue: add semicolon to HTML entity so it can be decoded. // @link https://www.php.net/manual/en/function.html-entity-decode.php#104617 $match[1] .= ';'; } return $match[1]; }, $string ); // Fix stored XSS security issue: decode HTML entities from URL. $string = html_entity_decode( (string) $string ); $remove = [ // Fix stored XSS security issue: remove inline JS from URL. 'javascript:', ]; foreach ( $remove as $remove_string ) { while ( stripos( $string, $remove_string ) !== false ) { $string = str_ireplace( $remove, '', $string ); } } $entities = [ '%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D', ]; $replacements = [ '!', '*', "'", '(', ')', ';', ':', '@', '&', '=', '+', '$', ',', '/', '?', '%', '#', '[', ']', ]; return str_replace( $entities, $replacements, rawurlencode( $string ) ); }
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::back(); } else { notfoundController::handle_not_found(); } }
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(); // let the user know we did stuff. flash('message', gt("Banner statistics reset.")); expHistory::back(); }
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