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 $val['parent_id']; } return false; }
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::STATUS_DONE => t('Done'), ), 'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()), 'subtask' => $subtask, 'task' => $task, ))); }
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 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.co:99', $uri->getAuthority()); // No scheme $uri = new Uri('foo.co:99'); $this->assertEquals('foo.co:99', $uri->getAuthority()); // No host or port $uri = new Uri('http:'); $this->assertEquals('', $uri->getAuthority()); // No host or port $uri = new Uri('http://foo.co'); $this->assertEquals('foo.co', $uri->getAuthority()); }
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->parent == -1) { $current = $sectionObj; } else { foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } assign_to_template(array( 'sections' => $navsections, 'current' => $current, 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0), )); }
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(); ?> <div id="poststuff"><div id="post-body"> <?php //$tab_keys = array_keys($this->menu_tabs); call_user_func(array(&$this, $this->menu_tabs_handler[$tab])); ?> </div></div> </div><!-- end of wrap --> <?php }
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 = $listSeparators[0]; } if ( isset( $listSeparators[1] ) ) { $this->itemStart = $listSeparators[1]; } if ( isset( $listSeparators[2] ) ) { $this->itemEnd = $listSeparators[2]; } if ( isset( $listSeparators[3] ) ) { $this->listEnd = $listSeparators[3]; } }
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( $vendor->title, $vendor->table, $vendor->tablename, $vendor->classname, $vendor->identifier ); assign_to_template(array( 'vendor_title' => $vendor_title, 'vendor'=>$vendor )); } }
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))) { $res = $target; } @unlink($local); } return $res; }
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, 'pages' => $pages, 'format' => 'html', ])->render(); return $this->containHtml($html); }
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 update the option groups that are already using it. if ($oldtitle != $opt->title) { }$db->sql('UPDATE '.$db->prefix.'option SET title="'.$opt->title.'" WHERE option_master_id='.$opt->id); expHistory::back(); }
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->not) { $_where = "array('NOT',$_where)"; } $boucle->where[] = $_where; }
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' => ['nullable', 'numeric'], 'weight' => ['nullable', 'numeric', 'min:0'] ]; }
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_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']]; } else { $this->params['required_shipping_calculator_id'] = 0; } $discount->update($this->params); expHistory::back(); }
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'; // quarantine folder name - required to check archive (must be hidden) $this->options['rootCssClass'] = 'elfinder-navbar-root-local'; $this->options['followSymLinks'] = true; $this->options['detectDirIcon'] = ''; // file name that is detected as a folder icon e.g. '.diricon.png' $this->options['keepTimestamp'] = array('copy', 'move'); // keep timestamp at inner filesystem allowed 'copy', 'move' and 'upload' $this->options['substituteImg'] = true; // support substitute image with dim command $this->options['statCorrector'] = null; // callable to correct stat data `function(&$stat, $path, $statOwner, $volumeDriveInstance){}` }
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, 'header' => 'Content-type: application/x-www-form-urlencoded', 'ignore_errors' => 1, // available since PHP 5.2.10 )))); if ($file === false) { $this->error = $php_errormsg; return $file; } if (!preg_match('~^HTTP/[0-9.]+ 2~i', $http_response_header[0])) { $this->error = $file; return false; } $return = json_decode($file, true); if ($return === null) { if (!$this->isQuerySelectLike($query) && $file === '') { return true; } $this->errno = json_last_error(); if (function_exists('json_last_error_msg')) { $this->error = json_last_error_msg(); } else { $constants = get_defined_constants(true); foreach ($constants['json'] as $name => $value) { if ($value == $this->errno && preg_match('~^JSON_ERROR_~', $name)) { $this->error = $name; break; } } } } return new Min_Result($return); }
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... $url = Options::get('siteurl')."/index.php?cat={$vars}"; break; } return $url; }
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 { $this->flash->failure(t('Unable to remove this column.')); } $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); }
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_RADDB . "/authorized_macs"; $files['virtual-server-default'] = FREERADIUS_RADDB . "/sites-enabled/default"; $files['ldap'] = FREERADIUS_MODSENABLED . "/ldap"; if ($files[$file] != "" && file_exists($files[$file])) { print '<pre>'; print $files[$file] . "\n" . file_get_contents($files[$file]); print '</pre>'; } }
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), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); //eDebug($page); assign_to_template(array( 'page'=>$page )); }
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(_convert($data['bn_label_nature'], YW_CHARSET, true)) . '" ,' . '`bn_template`="' . addslashes(_convert($data['bn_template'], YW_CHARSET, true)) . '" ,' . '`bn_description`="' . addslashes(_convert($data['bn_description'], YW_CHARSET, true)) . '" ,' . '`bn_sem_context`="' . addslashes(_convert($data['bn_sem_context'], YW_CHARSET, true)) . '" ,' . '`bn_sem_type`="' . addslashes(_convert($data['bn_sem_type'], YW_CHARSET, true)) . '" ,' . '`bn_sem_use_template`=' . (isset($data['bn_sem_use_template']) ? '1' : '0') . ' ,' . '`bn_condition`="' . addslashes(_convert($data['bn_condition'], YW_CHARSET, true)) . '"' . ' WHERE `bn_id_nature`=' . $data['bn_id_nature']);
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); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($valid) { if ($this->tagModel->update($values['id'], $values['name'])) { $this->flash->success(t('Tag updated successfully.')); } else { $this->flash->failure(t('Unable to update this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); } else { $this->edit($values, $errors); } }
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); $section->parent = -1; $db->updateObject($section, 'section'); expSession::clearAllUsersSessionCache('navigation'); expHistory::back(); } else { notfoundController::handle_not_authorized(); } }
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->id); //eDebug($product_type); $tpl = $product_type->getForm('show'); if (!empty($tpl)) $template = new controllertemplate($this, $tpl); //eDebug($template); $this->grabConfig(); // grab the global config assign_to_template(array( 'config' => $this->config, 'product' => $product_type, 'last_category' => $order->lastcat )); }
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->getId()) { throw new AccessForbiddenException(); } return $comment; }
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($expected); $input['_blank_passwd'] = 1; $result = $ldap->prepareInputForUpdate($input); //rootdn_passwd is set but empty $this->string($result['rootdn_passwd'])->isEmpty(); //Field name finishing with _field : set the value in lower case $input['_login_field'] = 'TEST'; $result = $ldap->prepareInputForUpdate($input); $this->string($result['_login_field'])->isIdenticalTo('test'); $input['sync_field'] = 'sync_field'; $result = $ldap->prepareInputForUpdate($input); $this->string($result['sync_field'])->isIdenticalTo('sync_field'); //test sync_field update $ldap->fields['sync_field'] = 'sync_field'; $result = $ldap->prepareInputForUpdate($input); $this->array($result)->notHasKey('sync_field'); $this->calling($ldap)->isSyncFieldUsed = false; $result = $ldap->prepareInputForUpdate($input); $this->array($result)->hasKey('sync_field'); $this->calling($ldap)->isSyncFieldUsed = true; $input['sync_field'] = 'another_field'; $result = $ldap->prepareInputForUpdate($input); $this->boolean($result)->isFalse(); }
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,null,null,$maxwidth); // since most likely this function will only get hit via flash in YUI Uploader // and since Flash can't pass cookies, we lose the knowledge of our $user // so we're passing the user's ID in as $_POST data. We then instantiate a new $user, // and then assign $user->id to $file->poster so we have an audit trail for the upload if (is_object($file)) { $resized = !empty($file->resized) ? true : false; $user = new user($this->params['usrid']); $file->poster = $user->id; $file->posted = $file->last_accessed = time(); $file->save(); if (!empty($this->params['cat'])) { $expcat = new expCat($this->params['cat']); $params['expCat'][0] = $expcat->id; $file->update($params); } // a echo so YUI Uploader is notified of the function's completion if ($resized) { echo gt('File resized and then saved'); } else { echo gt('File saved'); } } else { echo gt('File was NOT uploaded!'); // flash('error',gt('File was not uploaded!')); } }
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 passed, retrieve it if ($tval == false) { $this->tval = $this->POP3_TIMEOUT; } else { $this->tval = $tval; } $this->do_debug = $debug_level; $this->username = $username; $this->password = $password; // Refresh the error log $this->error = null; // Connect $result = $this->Connect($this->host, $this->port, $this->tval); if ($result) { $login_result = $this->Login($this->username, $this->password); if ($login_result) { $this->Disconnect(); return true; } } // We need to disconnect regardless if the login succeeded $this->Disconnect(); return false; }
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('statistics_api')) { $user = null; if (AuthUser::isLoggedIn()) $user = AuthUser::getUserName(); $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : ($_SERVER['REMOTE_ADDR']); $event = array('event_type' => 'hack_attempt', // simple event type identifier 'description' => __('A possible hack attempt was detected.'), // translatable description 'ipaddress' => $ip, 'username' => $user); Observer::notify('stats_file_manager_hack_attempt', $event); } */ } $filename = str_replace('..', '', $filename); // Clean up nicely $filename = str_replace('//', '', $filename); // We don't allow leading slashes $filename = preg_replace('/^\//', '', $filename); // Check if file had URL_SUFFIX - if so, append it to filename $filename .= (isset($_GET['has_url_suffix']) && $_GET['has_url_suffix']==='1') ? URL_SUFFIX : ''; $file = FILES_DIR . '/' . $filename; if (!$this->_isImage($file) && file_exists($file)) { $content = file_get_contents($file); } $this->display('file_manager/views/view', array( 'csrf_token' => SecureToken::generateToken(BASE_URL.'plugin/file_manager/save/'.$filename), 'is_image' => $this->_isImage($file), 'filename' => $filename, 'content' => $content )); }
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->filter[$cmd=$func]) && function_exists($cmd)) || is_string($cmd=$this->filter($func)))? $cmd.'('.$str.')': 'Base::instance()->'. 'call($this->filter(\''.$func.'\'),['.$str.'])'; } return $str; }
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['exceptions'])) { $options['http_errors'] = $options['exceptions']; unset($options['exceptions']); } $request = $this->applyOptions($request, $options); $handler = $options['handler']; try { return Promise\promise_for($handler($request, $options)); } catch (\Exception $e) { return Promise\rejection_for($e); } }
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 = $this->aggregateWhereClause(); $where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id);
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->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 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($_REQUEST['access']); $this->groups = $_REQUEST['groups']; if($this->access < 3) { $this->groups = array(); } $this->permission = intval($_REQUEST['permission']); $this->visible = intval($_REQUEST['visible']); $this->date_published = (empty($_REQUEST['date_published'])? '' : core_date2ts($_REQUEST['date_published'])); $this->date_unpublish = (empty($_REQUEST['date_unpublish'])? '' : core_date2ts($_REQUEST['date_unpublish'])); // language strings and options $this->dictionary = array(); $this->paths = array(); $fields = array('title', 'action-type', 'action-jump-item', 'action-jump-branch', 'action-new-window', 'action-masked-redirect'); //, 'path', 'visible'); foreach($_REQUEST as $key => $value) { if(empty($value)) { continue; } foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') { $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; } } if(substr($key, 0, strlen('path-'))=='path-') { $this->paths[substr($key, strlen('path-'))] = $value; } } }
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[$i]->title; $msg .= "BEGIN:VEVENT\n"; $msg .= $dtstart . $dtend; $msg .= "UID:" . $items[$i]->date_id . "\n"; $msg .= "DTSTAMP:" . date("Ymd\THis", time()) . "Z\n"; if ($title) { $msg .= "SUMMARY:$title\n"; } if ($body) { $msg .= "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" . $body . "\n"; } // if($link_url) { $msg .= "URL: $link_url\n";} if (!empty($this->config['usecategories'])) { if (!empty($items[$i]->expCat[0]->title)) { $msg .= "CATEGORIES:".$items[$i]->expCat[0]->title."\n"; } else { $msg .= "CATEGORIES:".$this->config['uncat']."\n"; } } $msg .= "END:VEVENT\n"; }
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['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; $comment = new expComment($this->params['id']); $comment->approved = $comment->approved == 1 ? 0 : 1; if ($comment->approved) { $this->sendApprovalNotification($comment,$this->params); } $comment->save(); expHistory::back(); }
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->id); //eDebug($product_type); $tpl = $product_type->getForm('show'); if (!empty($tpl)) $template = new controllertemplate($this, $tpl); //eDebug($template); $this->grabConfig(); // grab the global config assign_to_template(array( 'config' => $this->config, 'product' => $product_type, 'last_category' => $order->lastcat )); }
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); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($valid) { if ($this->tagModel->update($values['id'], $values['name'])) { $this->flash->success(t('Tag updated successfully.')); } else { $this->flash->failure(t('Unable to update this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); } else { $this->edit($values, $errors); } }
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 = $posts; } return $posts; }
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 ($branch && Preg::isMatch('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) { $branches[$match[1]] = $match[2]; } } $this->process->execute('hg bookmarks', $output, $this->repoDir); foreach ($this->process->splitLines($output) as $branch) { if ($branch && Preg::isMatch('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) { $bookmarks[$match[1]] = $match[2]; } } // Branches will have preference over bookmarks $this->branches = array_merge($bookmarks, $branches); } return $this->branches; }
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}'"); $ctr2++; } } //Check if the user choose from the dropdown if(!empty($user_default)) { if($user_default == $anonymous) { $u_id = 0; } else { $u_id = $user_default; } $where .= "user_id = {$u_id}"; } //Get all the search query records $records = $db->selectObjects('search_queries', $where); for ($i = 0, $iMax = count($records); $i < $iMax; $i++) { if(!empty($records[$i]->user_id)) { $u = user::getUserById($records[$i]->user_id); $records[$i]->user = $u->firstname . ' ' . $u->lastname; } } $page = new expPaginator(array( 'records' => $records, 'where'=>1, 'model'=>'search_queries', 'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? 10 : $this->config['limit'], 'order'=>empty($this->config['order']) ? 'timestamp' : $this->config['order'], 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'columns'=>array( 'ID'=>'id', gt('Query')=>'query', gt('Timestamp')=>'timestamp', gt('User')=>'user_id', ), )); $uname['id'] = implode($uname['id'],','); $uname['name'] = implode($uname['name'],','); assign_to_template(array( 'page'=>$page, 'users'=>$uname, 'user_default' => $user_default, 'badSearch' => $badSearch )); }
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( 'countries'=>$countries, 'regions'=>$regions )); }
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 = ucfirst($action) . '_Action'; // tworzy obiekt kontrolera: if (file_exists($class_file)) { include $class_file; if (class_exists($class_name)) { $this->controller_object = new $class_name($this); $this->set_acl($this); } else { die ('Class: <h3>'.$class_name.'</h3> not found.'); } } else { die ('File: <h3>'.$class_file.'</h3> not found.'); } // tworzy obiekt modelu: $this->set_model_object(MODULE_NAME); // tworzy obiekt widoku: $this->set_view_object(MODULE_NAME); // wywołuje akcję (metodę) kontrolera: if (method_exists($class_name, $class_method)) { $this->controller_object->{$class_method}(); } else { die ('Method: <h3>'.$class_method.'</h3> in class: <h3>'.$class_name.'</h3> not found.'); } }
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) { return array(true, $eml->message); } else { return array(true, ""); } } else { return array (false, Yii::t('app', "Email could not be sent")); } }
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_encode($result); }
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', 'errorcode' => 46, 'errormsg' => 'Unable to access image group'); } $resources = getUserResources(array("imageAdmin"), array("manageGroup")); if(!array_key_exists($imageid, $resources['image'])){ return array('status' => 'error', 'errorcode' => 47, 'errormsg' => 'Unable to access image'); } $allimages = getImages(); $query = "INSERT IGNORE INTO resourcegroupmembers " . "(resourceid, resourcegroupid) VALUES " . "({$allimages[$imageid]['resourceid']}, $groupid)"; doQuery($query, 287); return array('status' => 'success'); } else { return array('status' => 'error', 'errorcode' => 83, 'errormsg' => 'invalid resource group name'); } }
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 CDbColumnSchema; if($existing){ $valid = $this->modifyColumn(); } } return $valid; }
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['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/save/'.$data['name'])) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/view/'.$data['name'])); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/view/'.$data['name'])); } if (file_exists($file)) { if (file_put_contents($file, $data['content']) !== false) { Flash::set('success', __('File has been saved with success!')); } else { Flash::set('error', __('File is not writable! File has not been saved!')); } } else { if (file_put_contents($file, $data['content'])) { Flash::set('success', __('File :name has been created with success!', array(':name' => $data['name']))); } else { Flash::set('error', __('Directory is not writable! File has not been saved!')); } } // save and quit or save and continue editing ? if (isset($_POST['commit'])) { redirect(get_url('plugin/file_manager/browse/' . substr($data['name'], 0, strrpos($data['name'], '/')))); } else { redirect(get_url('plugin/file_manager/view/' . $data['name'] . (endsWith($data['name'], URL_SUFFIX) ? '?has_url_suffix=1' : ''))); }
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.rc_cur_id' ] ); $this->addGroupBy( 'rc.rc_cur_id' ); }
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.'px;'; } $r .= '<div class="miniature_border gallery_div" style="background-image:url(\''.$this->tiles_array[$i]->getMiniatureSrc().'\');margin-top:'.$top.'px; margin-left:'.$left.'px;'.$extra.'"></div>'; } return $r; }
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)){ if (!$v_code || $v_code != session('v_code')) { $this->sendError(10206,L('verification_code_are_incorrect')); return; } } session('v_code',null) ; $item = D("Item")->where("item_id = '$item_id' ")->find(); if ($item['password'] == $password) { session("visit_item_".$item_id , 1 ); $this->sendResult(array("refer_url"=>base64_decode($refer_url))); }else{ D("VerifyCode")->_ins_times($key);//输错密码则设置输错次数 if(D("VerifyCode")->_check_times($key,10)){ $error_code = 10307 ; }else{ $error_code = 10308 ; } $this->sendError($error_code,L('access_password_are_incorrect')); } }
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 successfully'), $file); } else { $ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it.")); } $ar->send(); echo json_encode($file); //FIXME we exit before hitting this }
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(route('rules.index')); }
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 section($id); if ($current->parent == -1) { // standalone page $navsections = section::levelTemplate(-1, 0); foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } else { $navsections = section::levelTemplate(0, 0); foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } assign_to_template(array( 'sections' => $navsections, 'current' => $current, )); }
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})`} </div> <button type="button" name="delete" class="btn btn-ghost-danger"> <i class="ti ti-x" title="${__('Delete')}"></i> </button> `); });
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 ) ); $q = Db::insert($sql); if ($q) { return true; }else{ return false; } }
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'] . "*' 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
foreach ($day as $extevent) { $event_cache = new stdClass(); $event_cache->feed = $extgcalurl; $event_cache->event_id = $extevent->event_id; $event_cache->title = $extevent->title; $event_cache->body = $extevent->body; $event_cache->eventdate = $extevent->eventdate->date; if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400) $event_cache->dateFinished = $extevent->dateFinished; if (isset($extevent->eventstart)) $event_cache->eventstart = $extevent->eventstart; if (isset($extevent->eventend)) $event_cache->eventend = $extevent->eventend; if (isset($extevent->is_allday)) $event_cache->is_allday = $extevent->is_allday; $found = false; if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries $found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate); if (!$found) $db->insertObject($event_cache,'event_cache'); }
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 if($term == '') $this->output(self::BAD_REQUEST, null, 'term-parameter is missing.'); // get matches $matches = FrontendSearchModel::getStartsWith($term, FRONTEND_LANGUAGE, $limit); // get search url $url = FrontendNavigation::getURLForBlock('search'); // loop items and set search url foreach($matches as &$match) $match['url'] = $url . '?form=search&q=' . $match['term']; // output $this->output(self::OK, $matches); }
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 = $httpCacheEnabled; $this->maintenanceResolver = $maintenanceModeResolver; }
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->type ('data', $csv); $this->clickAndWait ("dom=document.querySelector ('input[type=\"submit\"]')"); $this->assertCsvUploaded ($csv); }
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 downloadable file.', 'simple-download-monitor'); echo '<br /><br />'; echo '<div class="sdm-download-edit-file-url-section">'; echo '<input id="sdm_upload" type="text" size="100" name="sdm_upload" value="' . $old_value . '" placeholder="http://..." />'; echo '</div>'; echo '<br />'; echo '<input id="upload_image_button" type="button" class="button-primary" value="' . __('Select File', 'simple-download-monitor') . '" />'; echo '<br /><br />'; _e('Steps to upload a file or choose one from your media library:', 'simple-download-monitor'); echo '<ol>'; echo '<li>Hit the "Select File" button.</li>'; echo '<li>Upload a new file or choose an existing one from your media library.</li>'; echo '<li>Click the "Insert" button, this will populate the uploaded file\'s URL in the above text field.</li>'; echo '</ol>'; wp_nonce_field('sdm_upload_box_nonce', 'sdm_upload_box_nonce_check'); }
Base
1