code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
static function getParentGroup($group_id) { global $user; $mdb2 = getConnection(); $sql = "select parent_id from tt_groups where id = $group_id and org_id = $user->org_id and status = 1"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { $val = $res->fetchRow(); return $va...
Base
1
public function IsSendmail() { if (!stristr(ini_get('sendmail_path'), 'sendmail')) { $this->Sendmail = '/var/qmail/bin/sendmail'; } $this->Mailer = 'sendmail'; }
Base
1
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_restriction/show', array( 'status_list' => array( SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::S...
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 function testGetAuthorityReturnsCorrectPort() { // HTTPS non-standard port $uri = new Uri('https://foo.co:99'); $this->assertEquals('foo.co:99', $uri->getAuthority()); // HTTP non-standard port $uri = new Uri('http://foo.co:99'); $this->assertEquals('foo.c...
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-...
Class
2
function render_menu_page() { echo '<div class="wrap">'; echo '<h2>'.__('Blacklist Manager','all-in-one-wp-security-and-firewall').'</h2>';//Interface title $this->set_menu_tabs(); $tab = $this->get_current_tab(); $this->render_menu_tabs(); ?> ...
Base
1
$q->close(); } self::$num_rows = $n; return $r; }
Base
1
public function __construct( \DPL\Parameters $parameters, \Parser $parser ) { parent::__construct( $parameters, $parser ); $this->textSeparator = $parameters->getParameter( 'inlinetext' ); $listSeparators = $parameters->getParameter( 'listseparators' ); if ( isset( $listSeparators[0] ) ) { $this->listStart ...
Class
2
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( ...
Class
2
protected function _copy($source, $targetDir, $name) { $res = false; if ($this->tmp) { $local = $this->getTempFile(); $target = $this->_joinPath($targetDir, $name); if (ftp_get($this->connect, $local, $source, FTP_BINARY) && ftp_put($this->connect, $target, $local, $this->ftpMode($target))) { ...
Base
1
public function chapterToContainedHtml(Chapter $chapter) { $pages = $chapter->getVisiblePages(); $pages->each(function ($page) { $page->html = (new PageContent($page))->render(); }); $html = view('chapters.export', [ 'chapter' => $chapter, 'pag...
Base
1
public function getQueryOrderby() { return ''; }
Base
1
->where('owned_by', '=', $userIdToCheck); }); }
Class
2
function update_option_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $opt = new option_master($id); $oldtitle = $opt->title; $opt->update($this->params); // if the title of the master changed we should...
Base
1
function critere_where_dist($idb, &$boucles, $crit) { $boucle = &$boucles[$idb]; if (isset($crit->param[0])) { $_where = calculer_liste($crit->param[0], $idb, $boucles, $boucle->id_parent); } else { $_where = '@$Pile[0]["where"]'; } if ($crit->cond) { $_where = "(($_where) ? ($_where) : '')"; } if ($crit...
Base
1
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
Base
1
public function rules() { return [ 'sku' => ['required'], 'name' => ['required', Rule::unique('products')->ignore($this->segment(3))], 'quantity' => ['required', 'integer', 'min:0'], 'price' => ['required', 'numeric', 'min:0'], 'sale_price' => ...
Base
1
public function getQuerySelect() { $R1 = 'R1_' . $this->id; $R2 = 'R2_' . $this->id; return "$R2.value AS `" . $this->name . "`"; }
Base
1
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
Base
1
public function update_discount() { $id = empty($this->params['id']) ? null : $this->params['id']; $discount = new discounts($id); // find required shipping method if needed if ($this->params['required_shipping_calculator_id'] > 0) { $this->params['required_shipping_metho...
Base
1
$text = preg_replace($exp, '', $text); } // Primary expression to filter out tags $exp = '/(?:^|\s|\.)(#\w+[-\w]+\w+|#\w+)(?:$|[^\'"])/u'; $matches = array(); preg_match_all($exp, $text, $matches); return $matches; }
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
$ip = getenv('HTTP_FORWARDED'); } else { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; }
Base
1
$resp = $this->asEditor()->get($entity->getUrl('/export/html')); $resp->assertDontSee('window.donkey'); $resp->assertDontSee('script'); $resp->assertSee('.my-test-class { color: red; }'); }
Base
1
function rootQuery($db, $query) { @ini_set('track_errors', 1); // @ - may be disabled $file = @file_get_contents("$this->_url/?database=$db", false, stream_context_create(array('http' => array( 'method' => 'POST', 'content' => $this->isQuerySelectLike($query) ? "$query FORMAT JSONCompact" : $query, ...
Base
1
public static function cat($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".$vars."/".Typo::slugify(Categories::name($vars)); break; default: # code... $u...
Base
1
public function toCompiled() { return $this->processor->processUpdate($this, []); }
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
$contents = ['form' => tep_draw_form('specials', 'specials.php', 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=deleteconfirm')];
Base
1
function get_file($file) { $files['radiusd'] = FREERADIUS_RADDB . "/radiusd.conf"; $files['eap'] = FREERADIUS_MODSENABLED . "/eap"; $files['sql'] = FREERADIUS_MODSENABLED . "/sql"; $files['clients'] = FREERADIUS_RADDB . "/clients.conf"; $files['users'] = FREERADIUS_RADDB . "/users"; $files['macs'] = FREERADIUS_RA...
Base
1
public function testIdExceptionPhp54() { session_start(); $this->proxy->setId('foo'); }
Base
1
public function testRemovesPreviouslyAddedHeaderOfDifferentCase() { $r = new Response(200, ['Foo' => 'Bar']); $r2 = $r->withHeader('foo', 'Bam'); $this->assertNotSame($r, $r2); $this->assertEquals('Bam', $r2->getHeaderLine('Foo')); }
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), ...
Class
2
static function displayname() { return gt("e-Commerce Category Manager"); }
Base
1
$chats[$index]->link = erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurl('user/login').'/(r)/'.rawurlencode(base64_encode('chat/single/'.$chat->id)); } }
Class
2
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar');
Base
1
public function update($data) { if ($this->securityController->isWikiHibernated()) { throw new \Exception(_t('WIKI_IN_HIBERNATION')); } return $this->dbService->query('UPDATE' . $this->dbService->prefixTable('nature') . 'SET ' . '`bn_label_nature`="' . addslashes(...
Base
1
return $wgLang->timeanddate( $article->mDate, true ); } return null; }
Class
2
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
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); ...
Class
2
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
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
public function setGroupBy($groupBy, $qoute = true) { $this->setData(null); if ($groupBy) { $this->groupBy = $groupBy; if ($qoute && strpos($groupBy, '`') !== 0) { $this->groupBy = '`' . $this->groupBy . '`'; } } return $this...
Base
1
$input = ['name' => 'ldap', 'rootdn_passwd' => $password]; $result = $ldap->prepareInputForUpdate($input); //Expected value to be encrypted using GLPIKEY key $expected = \Toolbox::encrypt(stripslashes($password), GLPIKEY); $this->string($result['rootdn_passwd'])->isIdenticalTo($expec...
Base
1
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,n...
Class
2
public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) { $this->host = $host; // If no port value is passed, retrieve it if ($port == false) { $this->port = $this->POP3_PORT; } else { $this->port = $port; } // If no port value is...
Class
2
function html_operation_successful( $p_redirect_url, $p_message = '' ) { echo '<div class="success-msg">'; if( !is_blank( $p_message ) ) { echo $p_message . '<br />'; } echo lang_get( 'operation_successful' ).'<br />'; print_bracket_link( $p_redirect_url, lang_get( 'proceed' ) ); echo '</div>'; }
Base
1
public function addOrderBy( $orderBy ) { if ( empty( $orderBy ) ) { throw new \MWException( __METHOD__ . ': An empty order by clause was passed.' ); } $this->orderBy[] = $orderBy; return true; }
Class
2
public function view() { $params = func_get_args(); $content = ''; $filename = urldecode(join('/', $params)); // Sanitize filename for securtiy // We don't allow backlinks if (strpos($filename, '..') !== false) { /* if (Plugin::isEnabled('sta...
Class
2
function token($str) { $fw=$this->fw; $str=trim(preg_replace('/\{\{(.+?)\}\}/s',trim('\1'), $fw->compile($str))); if (preg_match('/^(.+)(?<!\|)\|((?:\h*\w+(?:\h*[,;]?))+)$/s', $str,$parts)) { $str=trim($parts[1]); foreach ($fw->split(trim($parts[2],"\xC2\xA0")) as $func) $str=((empty($this->filte...
Base
1
private function transfer(RequestInterface $request, array $options) { // save_to -> sink if (isset($options['save_to'])) { $options['sink'] = $options['save_to']; unset($options['save_to']); } // exceptions -> http_error if (isset($options['excep...
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 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 load_from_post() { if(intval($_REQUEST['parent'])!=$this->id) // protection against selecting this same category as parent of itself { $this->parent = intval($_REQUEST['parent']); } $this->template = $_REQUEST['template']; $this->access = intval($_REQU...
Base
1
$body = str_replace(array("\n"), "<br />", $body); } else { // It's going elsewhere (doesn't like quoted-printable) $body = str_replace(array("\n"), " -- ", $body); } $title = $items[...
Base
1
public function approve_toggle() { if (empty($this->params['id'])) return; /* 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['re...
Class
2
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 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); ...
Base
1
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
Base
1
public static function recent($vars, $type = 'post') { $sql = "SELECT * FROM `posts` WHERE `type` = '{$type}' ORDER BY `date` DESC LIMIT {$vars}"; $posts = Db::result($sql); if(isset($posts['error'])){ $posts['error'] = "No Posts found."; }else{ $posts = $post...
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 getBranches() { if (null === $this->branches) { $branches = array(); $bookmarks = array(); $this->process->execute('hg branches', $output, $this->repoDir); foreach ($this->process->splitLines($output) as $branch) { if ($bra...
Class
2
$result = $search->getSearchResults($item->query, false, true); if(empty($result) && !in_array($item->query, $badSearchArr)) { $badSearchArr[] = $item->query; $badSearch[$ctr2]['query'] = $item->query; $badSearch[$ctr2]['count'] = $db->countObjects("search_queries", "query='{$item->query}'"); $ct...
Base
1
function searchName() { return gt("Calendar Event"); }
Base
1
function searchName() { return gt('Webpage'); }
Class
2
public function manage() { expHistory::set('manageable',$this->params); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( ...
Base
1
public static function activate($thm) { if (Options::update('themes', $thm)) { new Options(); return true; }else{ return false; } }
Base
1
public function getQuerySelect() { return "a.id AS `" . $this->name . "`"; }
Base
1
public function set_controller($controller, $action) { include CLASS_DIR . 'module.php'; $module = new Module($controller); define ('MODULE_NAME', $module->get_name()); $class_file = APP_DIR . 'controller/' . MODULE_NAME . '.php'; $class_name = ucfirst(MODULE_NAME) . '_Controller'; $class_method = ucfi...
Base
1
$eml->prepareBody(); } list ($success, $message) = $this->checkDoNotEmailFields ($eml); if (!$success) { return array ($success, $message); } $result = $eml->send($historyFlag); if (isset($result['code']) && $result['code'] == 200) { if (YII_UNIT_TESTING) { ...
Base
1
static function encrypt($string, $key) { $result = ''; for ($i=0; $i<strlen($string); $i++) { $char = substr($string, $i, 1); $keychar = substr($key, ($i % strlen($key))-1, 1); $char = chr(ord($char)+ord($keychar)); $result .= $char; } return base64_...
Base
1
function XMLRPCaddImageToGroup($name, $imageid){ $groups = getUserResources(array("imageAdmin"), array("manageGroup"), 1); if($groupid = getResourceGroupID("image/$name")){ if(!array_key_exists($groupid, $groups['image'])){ return array('status' => 'error', 'err...
Class
2
public function beforeSave () { $valid = parent::beforeSave (); if ($valid) { $table = Yii::app()->db->schema->tables[$this->myTableName]; $existing = array_key_exists($this->fieldName, $table->columns) && $table->columns[$this->fieldName] instanceof CDbColum...
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
private function _addcontribution( $option ) { $this->addTable( 'recentchanges', 'rc' ); $field = 'rc.rc_actor'; $this->addSelect( [ 'contribution' => 'SUM(ABS(rc.rc_new_len - rc.rc_old_len))', 'contributor' => $field ] ); $this->addWhere( [ $this->tableNames['page'] . '.page_id = rc.r...
Class
2
$posts_arr = json_decode(json_encode($posts), FALSE); // $posts[] = $posts; $post_arr[] = $posts_arr; $post = $post_arr; } }else{ $post = $post; } }else{
Base
1
public function get() { $r = '<div class="title gallery_div">'.$this->stack_name.'</div>'; for ($i = 0; $i < count($this->tiles_array); $i++) { $top = rand(-5, 5); $left = rand(-5, 5); $img_w = $this->tiles_array[$i]->getWidth(); $extra = ''; if ($img_w < IMAGE_WIDTH) { $extra = 'width:'.$img_w....
Base
1
public function pwd(){ $item_id = I("item_id/d"); $password = I("password"); $v_code = I("v_code"); $refer_url = I('refer_url'); //检查用户输错密码的次数。如果超过一定次数,则需要验证 验证码 $key= 'item_pwd_fail_times_'.$item_id; if(!D("VerifyCode")->_check_times($key,10)){ i...
Compound
4
public function testPortMustBeValid() { (new Uri(''))->withPort(100000); }
Base
1
public function editAlt() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->alt = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your alt was updated succ...
Class
2
header("Location: ".$this->makeLink(array('section'=>intval($_REQUEST['section']))),TRUE,301);
Base
1
public function testCanGiveCustomProtocolVersion() { $r = new Response(200, [], null, '1000'); $this->assertEquals('1000', $r->getProtocolVersion()); }
Base
1
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
Base
1
public function down(RuleGroup $ruleGroup) { $maxOrder = $this->repository->maxOrder(); $order = (int)$ruleGroup->order; if ($order < $maxOrder) { $newOrder = $order + 1; $this->repository->setOrder($ruleGroup, $newOrder); } return redirect(rou...
Compound
4
public function breadcrumb() { global $sectionObj; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // Show not only the location of a page in the hierarchy but also the location of a standalone page $current = new secti...
Class
2
public function Close() { $this->error = null; // so there is no confusion $this->helo_rply = null; if(!empty($this->smtp_conn)) { // close the connection and cleanup fclose($this->smtp_conn); $this->smtp_conn = 0; } }
Class
2
firstname: l.attr('data-firstname') }); l.append(` <div class="member-details"> ${member_item} ${l.attr('data-name') || `${member_itemtype} (${member_items_id})`} </d...
Base
1
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
Base
1
protected function _mkfile($path, $name) { if ($this->tmp) { $path = $this->_joinPath($path, $name); $local = $this->getTempFile(); $res = touch($local) && ftp_put($this->connect, $path, $local, FTP_ASCII); @unlink($local); return $res ? $path : false; } return false; }
Base
1
protected function forceChangePassword() { if (!Yii::$app->user->isMustChangePasswordUrl()) { return Yii::$app->getResponse()->redirect(Url::toRoute(Yii::$app->user->mustChangePasswordRoute)); } }
Class
2
public static function addParam($param, $value, $post_id) { $sql = array( 'table' => 'posts_param', 'key' => array( 'post_id' => $post_id, 'param' => $param, 'value' => $value )...
Base
1
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
foreach ($day as $extevent) { $event_cache = new stdClass(); $event_cache->feed = $extgcalurl; $event_cache->event_id = $extevent->event_id; $event_cache->title = $extevent->title; ...
Class
2
public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // get parameters $term = SpoonFilter::getPostValue('term', null, ''); $limit = (int) FrontendModel::getModuleSetting('search', 'autocomplete_num_items', 10); // validate i...
Base
1
static function displayname() { return gt("Navigation"); }
Class
2
public function __construct( CartService $cartService, int $defaultTtl, bool $httpCacheEnabled, MaintenanceModeResolver $maintenanceModeResolver ) { $this->cartService = $cartService; $this->defaultTtl = $defaultTtl; $this->httpCacheEnabled = $httpCacheEna...
Class
2
foreach ($days as $value) { $regitem[] = $value; }
Base
1
protected function prepareImport($model, $csvName) { $this->openX2 ('/admin/importModels?model='.ucfirst($model)); $csv = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'tests', 'data', 'csvs', $csvName )); $this-...
Base
1
public function display_sdm_upload_meta_box($post) { // File Upload metabox $old_upload = get_post_meta($post->ID, 'sdm_upload', true); $old_value = isset($old_upload) ? $old_upload : ''; _e('Manually enter a valid URL of the file in the text box below, or click "Select File" button to upload (or choose) the d...
Base
1