code stringlengths 12 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
public function getQuerySelect()
{
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
$R3 = 'R3_' . $this->field->id;
return "$R2.id AS `" . $this->field->name . "`";
} | Base | 1 |
public static function getHelpVersion($version_id) {
global $db;
return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"');
} | Base | 1 |
foreach($fields as $field)
{
if(substr($key, 0, strlen($field.'-'))==$field.'-')
$this->dictionary[substr($key, strlen($field.'-'))][$field] = $value;
}
| Base | 1 |
private function isWindows()
{
return DIRECTORY_SEPARATOR !== '/';
} | 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 __construct(public Request $Request, public SessionInterface $Session, public Config $Config, public Logger $Log, public Csrf $Csrf)
{
$flashBag = $this->Session->getBag('flashes');
// add type check because SessionBagInterface doesn't have get(), only FlashBag has it
if ... | Base | 1 |
function searchByModelForm() {
// get the search terms
$terms = $this->params['search_string'];
$sql = "model like '%" . $terms . "%'";
$limit = !empty($this->config['limit']) ? $this->config['limit'] : 10;
$page = new expPaginator(array(
'model' => 'produc... | Class | 2 |
public function isAuthorizedBackendUserSession()
{
if (!$this->hasSessionCookie()) {
return false;
}
$this->initializeSession();
if (empty($_SESSION['authorized']) || empty($_SESSION['isBackendSession'])) {
return false;
}
return !$this->is... | Base | 1 |
protected function shouldRedirect(Request $request, Shop $shop)
{
return //for example: template preview, direct shop selection via url
(
$request->isGet()
&& $request->getQuery('__shop') !== null
&& $request->getQuery('__shop') != $shop->getId... | Base | 1 |
protected function getFooService()
{
return $this->services['Bar\Foo'] = new \Bar\Foo();
} | Base | 1 |
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
} | Base | 1 |
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
| Class | 2 |
public function SendAndMail($from) {
$this->error = null; // so no confusion is caused
if(!$this->connected()) {
$this->error = array(
"error" => "Called SendAndMail() without being connected");
return false;
}
fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
$r... | Class | 2 |
public function close()
{
$this->active = false;
return (bool) $this->handler->close();
} | Base | 1 |
public function manage_messages() {
expHistory::set('manageable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status_messages',
'where'=>1,
'limit'=>10,
'order'=>'body',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
... | 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 |
public function handle($request, Closure $next)
{
$checkCart = cart_get_items_count();
if (!$checkCart) {
//$shop_page = get_content('single=true&content_type=page&is_shop=1');
$shop_page = app()->content_repository->getFirstShopPage();
$redir = site_url();... | Base | 1 |
private function filterQueryAndFragment($str)
{
return preg_replace_callback(
'/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/',
[$this, 'rawurlencodeMatchZero'],
$str
);
} | 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... | Class | 2 |
function init_args()
{
$_REQUEST=strings_stripSlashes($_REQUEST);
$args = new stdClass();
$args->req_spec_id = isset($_REQUEST['req_spec_id']) ? $_REQUEST['req_spec_id'] : 0;
$args->doCompare = isset($_REQUEST['doCompare']) ? true : false;
$args->left_item_id = isset($_REQUEST['left_item_id']) ? intval($_REQUES... | 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 |
private function isFromTrustedProxy()
{
return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies);
} | 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 |
protected function getSubtask()
{
$subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id'));
if (empty($subtask)) {
throw new PageNotFoundException();
}
return $subtask;
} | Class | 2 |
public static function DragnDropReRank2() {
global $router, $db;
$id = $router->params['id'];
$page = new section($id);
$old_rank = $page->rank;
$old_parent = $page->parent;
$new_rank = $router->params['position'] + 1; // rank
$new_parent = intval($r... | Base | 1 |
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ; | Base | 1 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->checkPermission($project, $filter);
if ($this->customFilterModel->remove($filter['id']))... | Base | 1 |
protected function _unlink($path) {
return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime!="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows;
} | 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 |
$text = preg_replace( $skipPat, '', $text );
}
if ( self::open( $parser, $part1 ) ) {
//Handle recursion here, so we can break cycles.
if ( $recursionCheck == false ) {
$text = $parser->preprocess( $text, $parser->mTitle, $parser->mOptions );
self::close( $parser, $part1 );
}
if ( $maxLeng... | Class | 2 |
function edit_internalalias() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
... | Base | 1 |
function updateProfile($data) {
global $bigtree;
foreach ($data as $key => $val) {
if (substr($key,0,1) != "_" && !is_array($val)) {
$$key = sqlescape($val);
}
}
$id = sqlescape($this->ID);
if ($data["password"]) {
$phpass = new PasswordHash($bigtree["config"]["password_depth"], TRU... | Base | 1 |
$search_where = ['OR' => $ors]; | Base | 1 |
public function __get($var) {
switch ($var) {
case 'configuration_array':
$this->configuration_array = array();
if ($this->configuration != ''){
$jsonData = json_decode($this->configuration,true);
if ($jsonData !==... | Class | 2 |
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 |
function showByModel() {
global $order, $template, $db;
expHistory::set('viewable', $this->params);
$product = new product();
$model = $product->find("first", 'model="' . $this->params['model'] . '"');
//eDebug($model);
$product_type = new $model->product_type($model... | Class | 2 |
public static function fixName($name) {
$name = preg_replace('/[^A-Za-z0-9\.]/','_',$name);
if ($name[0] == '.')
$name[0] = '_';
return $name;
// return preg_replace('/[^A-Za-z0-9\.]/', '-', $name);
} | Base | 1 |
public function getQueryOrderby()
{
$uh = UserHelper::instance();
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return "$R2.ugroup_id";
} | Base | 1 |
public function actionGetItems($modelType){
$sql = 'SELECT id, name as value FROM x2_campaigns WHERE name LIKE :qterm ORDER BY name ASC';
$command = Yii::app()->db->createCommand($sql);
$qterm = '%'.$_GET['term'].'%';
$command->bindParam(":qterm", $qterm, PDO:... | Base | 1 |
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 |
private function validateImageMetadata($data)
{
if (\is_array($data)) {
foreach ($data as $value) {
if (!$this->validateImageMetadata($value)) {
return false;
}
}
} else {
if (1 === preg_match('/(<\?php?(.*?))/i', $data) || false !== stripos($data, '<?=') || false !== stripos($data, '<? ')) ... | Base | 1 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('SELECT *
FROM nv_webuser_groups
WHERE website = '.protect($website->id),
'object');
$out = $DB->resul... | Base | 1 |
protected function _save($fp, $dir, $name, $stat)
{
//TODO optionally encrypt $fp before uploading if mime is not already encrypted type
$path = $this->_joinPath($dir, $name);
return $this->connect->put($path, $fp)
? $path
: false;
} | Base | 1 |
public function showall() {
expHistory::set('viewable', $this->params);
$hv = new help_version();
//$current_version = $hv->find('first', 'is_current=1');
$ref_version = $hv->find('first', 'version=\''.$this->help_version.'\'');
// pagination parameter..hard coded for now.
$where = ... | Base | 1 |
public function getDisplayName ($plural=true) {
return Yii::t('marketing', 'Web Form');
} | Class | 2 |
} elseif ( $rowSize > 0 ) {
// repeat row header after n lines of output
$nstart = 0;
$nsize = $rowSize;
$count = count( $articles );
$output .= '{|' . $rowColFormat . "\n|\n";
do {
if ( $nstart + $nsize > $count ) {
$nsize = $count - $nstart;
}
$output .= $lister->formatList( $ar... | Class | 2 |
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';... | Base | 1 |
static function displayname() {
return "Events";
}
| Base | 1 |
public function approve_submit() {
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the... | Class | 2 |
public static function avatar($id){
$usr = Db::result(
sprintf("SELECT * FROM `user_detail` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1",
Typo::int($id),
Typo::cleanX($id)
)
);
return $usr[0]->avatar;
}
| Base | 1 |
$dt = date('Y-m-d', strtotime($match));
$sql = par_rep("/'$match'/", "'$dt'", $sql);
}
}
if (substr($sql, 0, 6) == "BEGIN;") {
$array = explode(";", $sql);
foreach ($array as $value) {
if ($value != "") {
$result = $connection->query($value);
if (!$result) {
$connecti... | Base | 1 |
public function myaddressbook() {
global $user;
// check if the user is logged in.
expQueue::flashIfNotLoggedIn('message',gt('You must be logged in to manage your address book.'));
if (!$user->isAdmin() && $this->params['user_id'] != $user->id) {
unset($this->params['user_id']);
}
... | Class | 2 |
protected function _fclose($fp, $path='') {
return @fclose($fp);
} | Base | 1 |
public static function custom($vars) {
$url = $vars;
return $url;
}
| Base | 1 |
public static function create(
RequestInterface $request,
ResponseInterface $response = null,
\Exception $previous = null,
array $ctx = []
) {
if (!$response) {
return new self(
'Error completing request',
$request,
... | Base | 1 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$action = $this->actionModel->getById($this->request->getIntegerParam('action_id'));
if (! empty($action) && $this->actionModel->remove($action['id'])) {
$this->flash->success(t('Acti... | Base | 1 |
public function getQuerySelect()
{
// SubmittedOn is stored in the artifact
return "a.submitted_on AS `" . $this->name . "`";
} | Base | 1 |
public function Login ($username = '', $password = '') {
if ($this->connected == false) {
$this->error = 'Not connected to POP3 server';
if ($this->do_debug >= 1) {
$this->displayErrors();
}
}
if (empty($username)) {
$username = $this->username;
}
if (empty($pass... | Base | 1 |
public function newpassword() {
if ($token = $this->param('token')) {
$user = $this->app->storage->findOne('cockpit/accounts', ['_reset_token' => $token]);
if (!$user) {
return false;
}
$user['md5email'] = md5($user['email']);
... | Base | 1 |
public function delete_version() {
if (empty($this->params['id'])) {
flash('error', gt('The version you are trying to delete could not be found'));
}
// get the version
$version = new help_version($this->params['id']);
if (empty($version->id)) {
flash('error', gt('The v... | Base | 1 |
public function loginForm( WebRequest $request ) { // Step 13
$out = $this->getOutput();
$username = $request->getVal('username');
$codes = SOA2Login::codes( $username );
$out->addHTML(Html::openElement('form', [ 'method' => 'POST' ]));
$out->addHTML(Html::hidden('username', $username));
$out->addHTML(Html... | Class | 2 |
public function confirm()
{
$task = $this->getTask();
$comment = $this->getComment();
$this->response->html($this->template->render('comment/remove', array(
'comment' => $comment,
'task' => $task,
'title' => t('Remove a comment')
)));
} | Base | 1 |
public function shouldRun(DateTime $date)
{
global $timedate;
$runDate = clone $date;
$this->handleTimeZone($runDate);
$cron = Cron\CronExpression::factory($this->schedule);
if (empty($this->last_run) && $cron->isDue($runDate)) {
return true;
}
... | Class | 2 |
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 |
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 |
function wp_validate_redirect($location, $default = '') {
$location = trim( $location );
// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
if ( substr($location, 0, 2) == '//' )
$location = 'http:' . $location;
// In php 5 parse_url may fail if the URL query pa... | Class | 2 |
public function testConvertsRequestsToStrings()
{
$request = new Psr7\Request('PUT', 'http://foo.com/hi?123', [
'Baz' => 'bar',
'Qux' => ' ipsum'
], 'hello', '1.0');
$this->assertEquals(
"PUT /hi?123 HTTP/1.0\r\nHost: foo.com\r\nBaz: bar\r\nQux: ipsum\... | Base | 1 |
$section = new section($this->params);
} else {
notfoundController::handle_not_found();
exit;
}
if (!empty($section->id)) {
$check_id = $section->id;
} else {
$check_id = $section->parent;
}
if (expPer... | Base | 1 |
function fread($handle, $length)
{
if (\yiiunit\framework\base\SecurityTest::$fread !== null) {
return \yiiunit\framework\base\SecurityTest::$fread;
}
if (\yiiunit\framework\base\SecurityTest::$fopen !== null) {
return $length < 8 ? \str_repeat('s', $length) : 'te... | Class | 2 |
function showAddBypassForm() {
$output = $this->pageContext->getOutput();
$request = $this->pageContext->getRequest();
$output->addHTML(
new OOUI\FormLayout([
'action' => SpecialPage::getTitleFor('ConfirmAccounts', wfMessage('scratch-confirmaccount-... | Compound | 4 |
function get_allowed_files_extensions_for_upload($fileTypes = 'images', $returnAsArray = false)
{
$are_allowed = '';
switch ($fileTypes) {
case 'img':
case 'image':
case 'images':
$are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg,webp,ico';
... | Base | 1 |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| Base | 1 |
$section = new section(intval($page));
if ($section) {
// self::deleteLevel($section->id);
$section->delete();
}
}
}
| Base | 1 |
public function rules()
{
$rules = [
'username' => 'required|unique:users,username',
'email' => 'unique:users,email',
];
return $rules;
} | Base | 1 |
function commit_criteria_list_to_query($criteria_list)
{
$criteria_list = str_replace('>', ' ASC', $criteria_list);
$criteria_list = str_replace('<', ' DESC', $criteria_list);
return $criteria_list;
} | Base | 1 |
$post = Db::query("UPDATE `options` SET `value`='{$v}' WHERE `name` = '{$k}' LIMIT 1");
}
}else{
$post = Db::query("UPDATE `options` SET `value`='{$val}' WHERE `name` = '{$key}' LIMIT 1");
}
return $post;
}
| Base | 1 |
public function getQuerySelect()
{
//Last update date is stored in the changeset (the date of the changeset)
return "c.submitted_on AS `" . $this->name . "`";
} | Base | 1 |
public function __construct(
CartService $cartService,
SalesChannelRepositoryInterface $productRepository,
PromotionItemBuilder $promotionItemBuilder,
ProductLineItemFactory $productLineItemFactory
) {
$this->cartService = $cartService;
$this->productRepository = ... | Base | 1 |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | Base | 1 |
public function getQueryGroupby()
{
// SubmittedOn is stored in the artifact
return 'a.submitted_by';
} | Base | 1 |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| Base | 1 |
$keys = array_keys($value);
// print_r($keys);
if ($keys[0] == $lang) {
$lang = $multilang[$key][$lang];
return $lang;
}
}
}
}
| Base | 1 |
. htmlspecialchars($table['table']) . '`</a>';
$html .= '</li>';
}
}
} else {
$html .= '<li class="warp_link">'
. ($this->_tableType == 'recent'
?__('There are no recent tables.')
... | 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' ... | Class | 2 |
public static function getHelpVersionId($version) {
global $db;
return $db->selectValue('help_version', 'id', 'version="'.$version.'"');
} | 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 reparent_standalone() {
$standalone = $this->section->find($this->params['page']);
if ($standalone) {
$standalone->parent = $this->params['parent'];
$standalone->update();
expSession::clearAllUsersSessionCache('navigation');
expHistory::... | Base | 1 |
public function getLayout(){
$layout = $this->getAttribute('layout');
$initLayout = $this->initLayout();
if(!$layout){ // layout hasn't been initialized?
$layout = $initLayout;
$this->layout = json_encode($layout);
$this->update(array('layout'));
... | Base | 1 |
private function applyParts(array $parts)
{
$this->scheme = isset($parts['scheme'])
? $this->filterScheme($parts['scheme'])
: '';
$this->userInfo = isset($parts['user']) ? $parts['user'] : '';
$this->host = isset($parts['host']) ? $parts['host'] : '';
$thi... | Base | 1 |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | Base | 1 |
public function manage_messages() {
expHistory::set('manageable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status_messages',
'where'=>1,
'limit'=>10,
'order'=>'body',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
... | 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 manage_versions() {
expHistory::set('manageable', $this->params);
$hv = new help_version();
$current_version = $hv->find('first', 'is_current=1');
$sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h ';
$sql .= 'RIGHT JOIN '.DB_TABLE_PREF... | Base | 1 |
function getResourceGroupID($groupdname) {
list($type, $name) = explode('/', $groupdname);
$query = "SELECT g.id "
. "FROM resourcegroup g, "
. "resourcetype t "
. "WHERE g.name = '$name' AND "
. "t.name = '$type' AND "
. "g.resourcetypeid = t.id";
$qh = doQue... | Class | 2 |
foreach ($days as $value) {
$regitem[] = $value;
}
| Class | 2 |
public function search() {
// global $db, $user;
global $db;
$sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email ";
$sql .= "from " . $db->prefix . "addresses as a "; //R J... | Base | 1 |
$loc = expCore::makeLocation('navigation', '', $standalone->id);
if (expPermissions::check('manage', $loc)) return true;
}
return false;
}
| Class | 2 |
public function settings_save() {
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!'));
redirec... | Class | 2 |
public function navigate_session()
{
global $website;
global $user;
global $DB;
$fid = $_REQUEST['fid'];
if(empty($fid))
$fid = 'dashboard';
$user_profile_name = $DB->query_single('name', 'nv_profiles', 'id='.protect($user->profile));
$this->add_content(
'<div class="navigate-help"... | Base | 1 |
public function renameRemote($oldName, $newName)
{
$this->run('remote', 'rename', $oldName, $newName);
return $this;
} | Class | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.