code
stringlengths 12
2.05k
| label_name
stringclasses 5
values | label
int64 0
4
|
---|---|---|
$iloc = expUnserialize($container->internal);
if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) {
// There is no sectionref for this container. Populate sectionref
if ($container->external != "N;") {
$newSecRef = new stdClass();
$newSecRef->module = $iloc->mod;
$newSecRef->source = $iloc->src;
$newSecRef->internal = '';
$newSecRef->refcount = 1;
// $newSecRef->is_original = 1;
$eloc = expUnserialize($container->external);
// $section = $db->selectObject('sectionref',"module='containermodule' AND source='".$eloc->src."'");
$section = $db->selectObject('sectionref',"module='container' AND source='".$eloc->src."'");
if (!empty($section)) {
$newSecRef->section = $section->id;
$db->insertObject($newSecRef,"sectionref");
$missing_sectionrefs[] = gt("Missing sectionref for container replaced").": ".$iloc->mod." - ".$iloc->src." - PageID #".$section->id;
} else {
$db->delete('container','id="'.$container->id.'"');
$missing_sectionrefs[] = gt("Cant' find the container page for container").": ".$iloc->mod." - ".$iloc->src.' - '.gt('deleted');
}
}
}
}
assign_to_template(array(
'missing_sectionrefs'=>$missing_sectionrefs,
));
} | Base | 1 |
public static function get_param($key = NULL) {
$info = [
'stype' => htmlentities(self::$search_type),
'stext' => htmlentities(self::$search_text),
'method' => htmlentities(self::$search_method),
'datelimit' => self::$search_date_limit,
'fields' => self::$search_fields,
'sort' => self::$search_sort,
'chars' => htmlentities(self::$search_chars),
'order' => self::$search_order,
'forum_id' => self::$forum_id,
'memory_limit' => self::$memory_limit,
'composevars' => self::$composevars,
'rowstart' => self::$rowstart,
'search_param' => self::$search_param,
];
return $key === NULL ? $info : (isset($info[$key]) ? $info[$key] : NULL);
} | 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' => 'product',
'where' => $sql,
'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit,
'order' => 'title',
'dir' => 'DESC',
'page' => (isset($this->params['page']) ? $this->params['page'] : 1),
'controller' => $this->params['controller'],
'action' => $this->params['action'],
'columns' => array(
gt('Model #') => 'model',
gt('Product Name') => 'title',
gt('Price') => 'base_price'
),
));
assign_to_template(array(
'page' => $page,
'terms' => $terms
));
} | Class | 2 |
$form .= "<option value='".$advertiser['clientid']."'>".htmlspecialchars(MAX_buildName($advertiser['clientid'], $advertiser['clientname']))."</option>";
}
$form .= "</select><input type='image' class='submit' src='" . OX::assetPath() . "/images/".$GLOBALS['phpAds_TextDirection']."/go_blue.gif'></form>";
addPageFormTool($GLOBALS['strMoveTo'], 'iconTrackerMove', $form);
//delete
$deleteConfirm = phpAds_DelConfirm($GLOBALS['strConfirmDeleteTracker']);
addPageLinkTool($GLOBALS["strDelete"], MAX::constructUrl(MAX_URL_ADMIN, "tracker-delete.php?token=" . urlencode(phpAds_SessionGetToken()) . "&clientid=".$advertiserId."&trackerid=".$trackerId."&returnurl=advertiser-trackers.php"), "iconDelete", null, $deleteConfirm);
addPageShortcut($GLOBALS['strBackToTrackers'], MAX::constructUrl(MAX_URL_ADMIN, "advertiser-trackers.php?clientid=$advertiserId"), "iconBack");
} | Compound | 4 |
public function approve() {
expHistory::set('editable', $this->params);
/* 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'];
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
$comment = new expComment($this->params['id']);
assign_to_template(array(
'comment'=>$comment
));
} | Base | 1 |
protected function configure() {
parent::configure();
if (!empty($this->options['tmpPath'])) {
if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'], 0755, true)) && is_writable($this->options['tmpPath'])) {
$this->tmp = $this->options['tmpPath'];
}
}
if (!$this->tmp && ($tmp = elFinder::getStaticVar('commonTempPath'))) {
$this->tmp = $tmp;
}
if (!$this->tmp && $this->tmbPath) {
$this->tmp = $this->tmbPath;
}
if (!$this->tmp) {
$this->disabled[] = 'mkfile';
$this->disabled[] = 'paste';
$this->disabled[] = 'duplicate';
$this->disabled[] = 'upload';
$this->disabled[] = 'edit';
$this->disabled[] = 'archive';
$this->disabled[] = 'extract';
}
// echo $this->tmp;
} | 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 confirm()
{
$project = $this->getProject();
$swimlane = $this->getSwimlane();
$this->response->html($this->helper->layout->project('swimlane/remove', array(
'project' => $project,
'swimlane' => $swimlane,
)));
} | Base | 1 |
private function SendHello($hello, $host) {
fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
$rply = $this->get_lines();
$code = substr($rply,0,3);
if($this->do_debug >= 2) {
$this->edebug("SMTP -> FROM SERVER: " . $rply . $this->CRLF . '<br />');
}
if($code != 250) {
$this->error =
array("error" => $hello . " not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) {
$this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />');
}
return false;
}
$this->helo_rply = $rply;
return true;
} | Class | 2 |
public function quicksearch($text)
{
global $DB;
global $website;
$like = ' LIKE '.protect('%'.$text.'%');
// we search for the IDs at the dictionary NOW (to avoid inefficient requests)
$DB->query('SELECT DISTINCT (nvw.node_id)
FROM nv_webdictionary nvw
WHERE nvw.node_type = "feed"
AND nvw.website = '.$website->id.'
AND nvw.text '.$like, 'array');
$dict_ids = $DB->result("node_id");
// all columns to look for
$cols[] = 'i.id' . $like;
if(!empty($dict_ids))
$cols[] = 'i.id IN ('.implode(',', $dict_ids).')';
$where = ' AND ( ';
$where.= implode( ' OR ', $cols);
$where .= ')';
return $where;
}
| Base | 1 |
public function confirm()
{
$project = $this->getProject();
$this->response->html($this->helper->layout->project('column/remove', array(
'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')),
'project' => $project,
)));
} | Base | 1 |
private function filterPort($scheme, $host, $port)
{
if (null !== $port) {
$port = (int) $port;
if (1 > $port || 0xffff < $port) {
throw new \InvalidArgumentException(
sprintf('Invalid port: %d. Must be between 1 and 65535', $port)
);
}
}
return $this->isNonStandardPort($scheme, $host, $port) ? $port : null;
} | Base | 1 |
public static function is_same($p1, $p2){
if($p1 == $p2){
return true;
}else{
return false;
}
}
| Base | 1 |
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 function get_view_config() {
global $template;
// set paths we will search in for the view
$paths = array(
BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure',
BASE.'framework/modules/common/views/file/configure',
);
foreach ($paths as $path) {
$view = $path.'/'.$this->params['view'].'.tpl';
if (is_readable($view)) {
if (bs(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
if (bs3(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
$template = new controllertemplate($this, $view);
$ar = new expAjaxReply(200, 'ok');
$ar->send();
}
}
} | Base | 1 |
public function adminBodyEnd()
{
global $L;
if (!in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) {
return false;
}
// Spell Checker
$spellCheckerEnable = $this->getValue('spellChecker')?'true':'false';
// Include plugin's Javascript files
$html = $this->includeJS('simplemde.min.js');
$html .= '<script>'.PHP_EOL;
$html .= 'var simplemde = null;'.PHP_EOL;
// Include add content to the editor
$html .= 'function addContentSimpleMDE(content) {
var text = simplemde.value();
simplemde.value(text + content + "\n");
simplemde.codemirror.refresh();
}'.PHP_EOL;
// Returns the content of the editor
// Function required for Bludit
$html .= 'function editorGetContent(content) {
return simplemde.value();
}'.PHP_EOL;
// Insert an image in the editor at the cursor position
// Function required for Bludit
$html .= 'function editorInsertMedia(filename) {
addContentSimpleMDE("");
}'.PHP_EOL;
$html .= '$(document).ready(function() { '.PHP_EOL;
$html .= 'simplemde = new SimpleMDE({
element: document.getElementById("jseditor"),
status: false,
toolbarTips: true,
toolbarGuideIcon: true,
autofocus: false,
placeholder: "'.$L->get('content-here-supports-markdown-and-html-code').'",
lineWrapping: true,
autoDownloadFontAwesome: false,
indentWithTabs: true,
tabSize: '.$this->getValue('tabSize').',
spellChecker: '.$spellCheckerEnable.',
toolbar: ['.Sanitize::htmlDecode($this->getValue('toolbar')).',
"|",
{
name: "pageBreak",
action: function addPageBreak(editor){
var cm = editor.codemirror;
output = "\n'.PAGE_BREAK.'\n";
cm.replaceSelection(output);
},
className: "oi oi-crop",
title: "'.$L->get('Pagebreak').'",
}]
});';
$html .= '}); </script>';
return $html;
} | 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('Action removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this action.'));
}
$this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
} | Class | 2 |
public function update()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
if ($valid) {
if ($this->swimlaneModel->update($values['id'], $values)) {
$this->flash->success(t('Swimlane updated successfully.'));
return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} else {
$errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
}
}
return $this->edit($values, $errors);
} | Base | 1 |
public function addBCC($address, $name = '')
{
return $this->addAnAddress('bcc', $address, $name);
} | Compound | 4 |
protected function getFullPath($path, $base)
{
$separator = $this->separator;
$systemroot = $this->systemRoot;
$base = (string)$base;
if ($base[0] === $separator && substr($base, 0, strlen($systemroot)) !== $systemroot) {
$base = $systemroot . substr($base, 1);
}
if ($base !== $systemroot) {
$base = rtrim($base, $separator);
}
// 'Here'
if ($path === '' || $path === '.' . $separator) return $base;
$sepquoted = preg_quote($separator, '#');
if (substr($path, 0, 3) === '..' . $separator) {
$path = $base . $separator . $path;
}
// normalize `/../`
$normreg = '#(' . $sepquoted . ')[^' . $sepquoted . ']+' . $sepquoted . '\.\.' . $sepquoted . '#'; // '#(/)[^\/]+/\.\./#'
while (preg_match($normreg, $path)) {
$path = preg_replace($normreg, '$1', $path, 1);
}
if ($path !== $systemroot) {
$path = rtrim($path, $separator);
}
// Absolute path
if ($path[0] === $separator || strpos($path, $systemroot) === 0) {
return $path;
}
$preg_separator = '#' . $sepquoted . '#';
// Relative path from 'Here'
if (substr($path, 0, 2) === '.' . $separator || $path[0] !== '.') {
$arrn = preg_split($preg_separator, $path, -1, PREG_SPLIT_NO_EMPTY);
if ($arrn[0] !== '.') {
array_unshift($arrn, '.');
}
$arrn[0] = rtrim($base, $separator);
return join($separator, $arrn);
}
return $path;
} | Base | 1 |
public function __construct($exceptions = false) {
$this->exceptions = ($exceptions == true);
} | Class | 2 |
public function getQuerySelect()
{
$R1 = 'R1_' . $this->id;
$R2 = 'R2_' . $this->id;
return "$R2.value AS `" . $this->name . "`";
} | Base | 1 |
function GETPOST($paramname,$check='',$method=0)
{
if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:'');
elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:'';
elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:'');
if (! empty($check))
{
// Check if numeric
if ($check == 'int' && ! preg_match('/^[-\.,0-9]+$/i',trim($out))) $out='';
// Check if alpha
//if ($check == 'alpha' && ! preg_match('/^[ =:@#\/\\\(\)\-\._a-z0-9]+$/i',trim($out))) $out='';
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
if ($check == 'alpha' && preg_match('/"/',trim($out))) $out='';
}
return $out;
} | Base | 1 |
public function editTitle() {
global $user;
$file = new expFile($this->params['id']);
if ($user->id==$file->poster || $user->isAdmin()) {
$file->title = $this->params['newValue'];
$file->save();
$ar = new expAjaxReply(200, gt('Your title was updated successfully'), $file);
} else {
$ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it."));
}
$ar->send();
} | Class | 2 |
public function confirm()
{
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->response->html($this->helper->layout->project('custom_filter/remove', array(
'project' => $project,
'filter' => $filter,
'title' => t('Remove a custom filter')
)));
} | Base | 1 |
$this->services['App\Bus'] = $instance = new \App\Bus(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}); | Base | 1 |
public function putAction(Request $request)
{
$this->checkArguments($request);
$user = $this->tokenStorage->getToken()->getUser();
$this->userManager->save($request->request->all(), $request->get('locale'), $user->getId(), true);
$user->setFirstName($request->get('firstName'));
$user->setLastName($request->get('lastName'));
$this->objectManager->flush();
$view = View::create($user);
$context = new Context();
$context->setGroups(['profile']);
$view->setContext($context);
return $this->viewHandler->handle($view);
} | Class | 2 |
function manage() {
global $db, $router, $user;
expHistory::set('manageable', $router->params);
assign_to_template(array(
'canManageStandalones' => self::canManageStandalones(),
'sasections' => $db->selectObjects('section', 'parent=-1'),
'user' => $user,
// 'canManagePagesets' => $user->isAdmin(),
// 'templates' => $db->selectObjects('section_template', 'parent=0'),
));
}
| Base | 1 |
foreach ($value_arr['ENROLLMENT_INFO'] as $eid => $ed) {
echo '<ENROLLMENT_INFO_' . htmlentities($eid) . '>';
echo '<SCHOOL_ID>' . htmlentities($ed['SCHOOL_ID']) . '</SCHOOL_ID>';
echo '<CALENDAR>' . htmlentities($ed['CALENDAR']) . '</CALENDAR>';
echo '<GRADE>' . htmlentities($ed['GRADE']) . '</GRADE>';
echo '<SECTION>' . htmlentities($ed['SECTION']) . '</SECTION>';
echo '<START_DATE>' . htmlentities($ed['START_DATE']) . '</START_DATE>';
echo '<DROP_DATE>' . htmlentities($ed['DROP_DATE']) . '</DROP_DATE>';
echo '<ENROLLMENT_CODE>' . htmlentities($ed['ENROLLMENT_CODE']) . '</ENROLLMENT_CODE>';
echo '<DROP_CODE>' . htmlentities($ed['DROP_CODE']) . '</DROP_CODE>';
echo '</ENROLLMENT_INFO_' . htmlentities($eid) . '>';
} | Base | 1 |
public function shippingMethodSave(Request $request) {
if (is_array($request->get('Address'))) {
$request->merge([
'city'=>$request->get('Address')['city'],
'zip'=>$request->get('Address')['zip'],
'state'=>$request->get('Address')['state'],
'address'=>$request->get('Address')['address'],
]);
}
session_append_array('checkout_v2', [
'shipping_gw'=> $request->get('shipping_gw'),
'city'=> $request->get('city'),
'address'=> $request->get('address'),
'country'=> $request->get('country'),
'state'=> $request->get('state'),
'zip'=> $request->get('zip'),
'other_info'=> $request->get('other_info'),
]);
$checkIfShippingEnabled = app()->shipping_manager->getShippingModules(true);
if ($checkIfShippingEnabled) {
$validate = $this->_validateShippingMethod();
if ($validate['valid'] == false) {
session_set('errors', $validate['errors']);
return redirect(route('checkout.shipping_method'));
}
}
// Success
return redirect(route('checkout.payment_method'));
} | Base | 1 |
public function column_description( $item ) {
$return = $item->object_name;
switch ( $item->object_type ) {
case 'Post' :
$return = sprintf( '<a href="%s">%s</a>', get_edit_post_link( $item->object_id ), $item->object_name );
break;
case 'Taxonomy' :
if ( ! empty( $item->object_id ) )
$return = sprintf( '<a href="%s">%s</a>', get_edit_term_link( $item->object_id, $item->object_subtype ), $item->object_name );
break;
case 'Comments' :
if ( ! empty( $item->object_id ) && $comment = get_comment( $item->object_id ) ) {
$return = sprintf( '<a href="%s">%s #%d</a>', get_edit_comment_link( $item->object_id ), $item->object_name, $item->object_id );
}
break;
case 'Export' :
if ( 'all' === $item->object_name ) {
$return = __( 'All', 'aryo-activity-log' );
} else {
$pt = get_post_type_object( $item->object_name );
$return = ! empty( $pt->label ) ? $pt->label : $item->object_name;
}
break;
case 'Options' :
case 'Core' :
$return = __( $item->object_name, 'aryo-activity-log' );
break;
}
$return = apply_filters( 'aal_table_list_column_description', $return, $item );
return $return;
} | Base | 1 |
$date->delete(); // event automatically deleted if all assoc eventdates are deleted
}
expHistory::back();
}
| Base | 1 |
$db->insertObject($obj, 'expeAlerts_subscribers');
}
$count = count($this->params['ealerts']);
if ($count > 0) {
flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.'));
} else {
flash('error', gt("You have been unsubscribed from all E-Alerts."));
}
expHistory::back();
} | Base | 1 |
static function description() {
return gt("This module is for managing categories in your store.");
} | Class | 2 |
protected function parse()
{
parent::parse();
// grab the error-type from the parameters
$errorType = $this->getParameter('type');
// set correct headers
switch($errorType)
{
case 'module-not-allowed':
case 'action-not-allowed':
SpoonHTTP::setHeadersByCode(403);
break;
case 'not-found':
SpoonHTTP::setHeadersByCode(404);
break;
}
// querystring provided?
if($this->getParameter('querystring') !== null)
{
// split into file and parameters
$chunks = explode('?', $this->getParameter('querystring'));
// get extension
$extension = SpoonFile::getExtension($chunks[0]);
// if the file has an extension it is a non-existing-file
if($extension != '' && $extension != $chunks[0])
{
// set correct headers
SpoonHTTP::setHeadersByCode(404);
// give a nice error, so we can detect which file is missing
echo 'Requested file (' . implode('?', $chunks) . ') not found.';
// stop script execution
exit;
}
}
// assign the correct message into the template
$this->tpl->assign('message', BL::err(SpoonFilter::toCamelCase(htmlspecialchars($errorType), '-')));
} | Base | 1 |
public function setModelAttributes(&$model,&$attributeList,&$params) {
$data = array ();
foreach($attributeList as &$attr) {
if(!isset($attr['name'],$attr['value']))
continue;
if(null !== $field = $model->getField($attr['name'])) {
// first do variable/expression evaluation, // then process with X2Fields::parseValue()
$type = $field->type;
$value = $attr['value'];
if(is_string($value)){
if(strpos($value, '=') === 0){
$evald = X2FlowFormatter::parseFormula($value, $params);
if(!$evald[0])
return false;
$value = $evald[1];
} elseif($params !== null){
if(is_string($value) && isset($params['model'])){
$value = X2FlowFormatter::replaceVariables(
$value, $params['model'], $type);
}
}
}
$data[$attr['name']] = $value;
}
}
if (!isset ($model->scenario))
$model->setScenario ('X2Flow');
$model->setX2Fields ($data);
if ($model instanceof Actions && isset($data['complete'])) {
switch($data['complete']) {
case 'Yes':
$model->complete();
break;
case 'No':
$model->uncomplete();
break;
}
}
return true;
} | Base | 1 |
public function execute(&$params){
$model = new Actions;
$model->type = 'note';
$model->complete = 'Yes';
$model->associationId = $params['model']->id;
$model->associationType = $params['model']->module;
$model->actionDescription = $this->parseOption('comment', $params);
$model->assignedTo = $this->parseOption('assignedTo', $params);
$model->completedBy = $this->parseOption('assignedTo', $params);
if(empty($model->assignedTo) && $params['model']->hasAttribute('assignedTo')){
$model->assignedTo = $params['model']->assignedTo;
$model->completedBy = $params['model']->assignedTo;
}
if($params['model']->hasAttribute('visibility'))
$model->visibility = $params['model']->visibility;
$model->createDate = time();
$model->completeDate = time();
if($model->save()){
return array(
true,
Yii::t('studio', 'View created action: ').$model->getLink());
}else{
return array(false, array_shift($model->getErrors()));
}
} | Class | 2 |
public function params()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
$this->create();
return;
}
$action = $this->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | Base | 1 |
foreach ($week as $dayNum => $day) {
if ($dayNum == $now['mday']) {
$currentweek = $weekNum;
}
if ($dayNum <= $endofmonth) {
// $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $db->countObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1;
$monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $ed->find("count", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1;
}
}
| Class | 2 |
public static function getId($id=''){
if(isset($id)){
$sql = sprintf("SELECT * FROM `menus` WHERE `id` = '%d' ORDER BY `order` ASC", $id);
$menus = Db::result($sql);
$n = Db::$num_rows;
}else{
$menus = '';
}
return $menus;
} | Compound | 4 |
public function withUserInfo($user, $password = null)
{
$info = $user;
if ($password) {
$info .= ':' . $password;
}
if ($this->userInfo === $info) {
return $this;
}
$new = clone $this;
$new->userInfo = $info;
return $new;
} | Base | 1 |
public function videoThumbnailTreeAction()
{
$this->checkPermission('thumbnails');
$thumbnails = [];
$list = new Asset\Video\Thumbnail\Config\Listing();
$groups = [];
foreach ($list->getThumbnails() as $item) {
if ($item->getGroup()) {
if (!$groups[$item->getGroup()]) {
$groups[$item->getGroup()] = [
'id' => 'group_' . $item->getName(),
'text' => $item->getGroup(),
'expandable' => true,
'leaf' => false,
'allowChildren' => true,
'iconCls' => 'pimcore_icon_folder',
'group' => $item->getGroup(),
'children' => [],
];
}
$groups[$item->getGroup()]['children'][] =
[
'id' => $item->getName(),
'text' => $item->getName(),
'leaf' => true,
'iconCls' => 'pimcore_icon_videothumbnails',
'cls' => 'pimcore_treenode_disabled',
'writeable' => $item->isWriteable(),
];
} else {
$thumbnails[] = [
'id' => $item->getName(),
'text' => $item->getName(),
'leaf' => true,
'iconCls' => 'pimcore_icon_videothumbnails',
'cls' => 'pimcore_treenode_disabled',
'writeable' => $item->isWriteable(),
];
}
}
foreach ($groups as $group) {
$thumbnails[] = $group;
}
return $this->adminJson($thumbnails);
} | Base | 1 |
public function confirm()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask/remove', array(
'subtask' => $subtask,
'task' => $task,
)));
} | Base | 1 |
public function authenticate($user, $pass)
{
global $DB;
$user = trim($user);
$user = mb_strtolower($user);
$A1 = md5($user.':'.APP_REALM.':'.$pass);
if($DB->query('SELECT *
FROM nv_users
WHERE LOWER(username) = '.protect($user)))
{
$data = $DB->result();
if($data[0]->password==$A1)
{
$this->load_from_resultset($data[0]);
$this->attempts = 0;
$this->update();
return true;
}
else if(!empty($data[0]->id))
{
$this->load_from_resultset($data[0]);
$this->attempts++;
if($this->attempts > 9)
$this->blocked = 1;
$this->update();
return false;
}
}
return false;
}
| Base | 1 |
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,
));
}
| Base | 1 |
public function sendData($data)
{
$url = $this->getEndpoint().'?'.http_build_query($data, '', '&');
$httpRequest = $this->httpClient->get($url);
$httpRequest->getCurlOptions()->set(CURLOPT_SSLVERSION, 6); // CURL_SSLVERSION_TLSv1_2 for libcurl < 7.35
$httpResponse = $httpRequest->send();
return $this->createResponse($httpResponse->getBody());
} | Base | 1 |
function DateInputAY($value, $name, $counter = 1, $placeholder = _enterDate)
{
$show = "";
$date_sep = "";
$monthVal = "";
$yearVal = "";
$dayVal = "";
$display = "";
if ($value != '')
return '<table><tr><td><div id="date_div_' . $counter . '" style="display: inline" >' . ProperDateAY($value) . ' </div></td><td><input type=text id="date_' . $counter . '" ' . $show . ' style="display:none" readonly></td><td><a onClick="init(' . $counter . ',2);"><img src="assets/calendar.gif" /></a></td><td><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" ><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" ></td></tr></table>';
else {
if ($counter == 2)
return '<input type="text" id="date_' . $counter . '" data-placeholder="' . $placeholder . '" class="form-control daterange-single"><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" /><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '" /><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" />';
else
return '<input type="text" id="date_' . $counter . '" data-placeholder="' . $placeholder . '" class="form-control daterange-single"><input type=hidden ' . $monthVal . ' id="monthSelect' . $counter . '" name="month_' . $name . '" /><input type=hidden ' . $dayVal . ' id="daySelect' . $counter . '" name="day_' . $name . '"><input type=hidden ' . $yearVal . ' id="yearSelect' . $counter . '" name="year_' . $name . '" />';
}
} | Base | 1 |
function insertCommandCategorieInDB(){
global $pearDB;
if (testCommandCategorieExistence($_POST["category_name"])){
$DBRESULT = $pearDB->query("INSERT INTO `command_categories` (`category_name` , `category_alias`, `category_order`) VALUES ('".$_POST["category_name"]."', '".$_POST["category_alias"]."', '1')");
}
} | Base | 1 |
rsvpmaker_tx_email($post, $mail);
}
$send_confirmation = get_post_meta($post->ID,'_rsvp_rsvpmaker_send_confirmation_email',true);
$confirm_on_payment = get_post_meta($post->ID,'_rsvp_confirmation_after_payment',true);
if(($send_confirmation ||!is_numeric($send_confirmation)) && empty($confirm_on_payment) )//if it hasn't been set to 0, send it
{
$confirmation_subject = $templates['confirmation']['subject'];
foreach($rsvpdata as $field => $value)
$confirmation_subject = str_replace('['.$field.']',$value,$confirmation_subject);
$confirmation_body = $templates['confirmation']['body'];
foreach($rsvpdata as $field => $value)
$confirmation_body = str_replace('['.$field.']',$value,$confirmation_body);
$confirmation_body = do_blocks(do_shortcode($confirmation_body));
$mail["html"] = wpautop($confirmation_body);
if(isset($post->ID)) // not for replay
$mail["ical"] = rsvpmaker_to_ical_email ($post->ID, $rsvp_to, $rsvp["email"]);
$mail["to"] = $rsvp["email"];
$mail["from"] = $rsvp_to_array[0];
$mail["fromname"] = get_bloginfo('name');
$mail["subject"] = $confirmation_subject;
rsvpmaker_tx_email($post, $mail);
}
} | Base | 1 |
function barcode_encode_genbarcode($code,$encoding)
{
global $genbarcode_loc;
// Clean parameters
if (preg_match("/^ean$/i", $encoding) && strlen($code)==13) $code=substr($code,0,12);
if (!$encoding) $encoding="ANY";
$encoding=preg_replace("/[\\\|]/", "_", $encoding);
$code=preg_replace("/[\\\|]/", "_", $code);
$command=escapeshellarg($genbarcode_loc);
$paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\"";
$fullcommandclear=$command." ".$paramclear." 2>&1";
//print $fullcommandclear."<br>\n";
dol_syslog("Run command ".$fullcommandclear);
$fp=popen($fullcommandclear, "r");
if ($fp)
{
$bars=fgets($fp, 1024);
$text=fgets($fp, 1024);
$encoding=fgets($fp, 1024);
pclose($fp);
}
else
{
dol_syslog("barcode.lib.php::barcode_encode_genbarcode failed to run popen ".$fullcommandclear, LOG_ERR);
return false;
}
//var_dump($bars);
$ret=array(
"encoding" => trim($encoding),
"bars" => trim($bars),
"text" => trim($text)
);
//var_dump($ret);
if (!$ret['encoding']) return false;
if (!$ret['bars']) return false;
if (!$ret['text']) return false;
return $ret;
} | Class | 2 |
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 recipient($toaddr)
{
return $this->sendCommand(
'RCPT TO',
'RCPT TO:<' . $toaddr . '>',
array(250, 251)
);
} | Class | 2 |
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 |
public function validate() {
global $db;
// check for an sef url field. If it exists make sure it's valid and not a duplicate
//this needs to check for SEF URLS being turned on also: TODO
if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) {
if (empty($this->sef_url)) $this->makeSefUrl();
if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();
if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();
}
// safeguard again loc data not being pass via forms...sometimes this happens when you're in a router
// mapped view and src hasn't been passed in via link to the form
if (isset($this->id) && empty($this->location_data)) {
$loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);
if (!empty($loc)) $this->location_data = $loc;
}
// run the validation as defined in the models
if (!isset($this->validates)) return true;
$messages = array();
$post = empty($_POST) ? array() : expString::sanitize($_POST);
foreach ($this->validates as $validation=> $field) {
foreach ($field as $key=> $value) {
$fieldname = is_numeric($key) ? $value : $key;
$opts = is_numeric($key) ? array() : $value;
$ret = expValidator::$validation($fieldname, $this, $opts);
if (!is_bool($ret)) {
$messages[] = $ret;
expValidator::setErrorField($fieldname);
unset($post[$fieldname]);
}
}
}
if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);
} | Base | 1 |
private function checkResponse ($string) {
if (substr($string, 0, 3) !== '+OK') {
$this->error = array(
'error' => "Server reported an error: $string",
'errno' => 0,
'errstr' => ''
);
if ($this->do_debug >= 1) {
$this->displayErrors();
}
return false;
} else {
return true;
}
} | Class | 2 |
function _makeMpName($value) {
if ($value != '') {
$get_name = DBGet(DBQuery('SELECT TITLE FROM marking_periods WHERE marking_period_id=' . $value));
return $get_name[1]['TITLE'];
} else
return ''._customCoursePeriod.'';
} | Base | 1 |
function delete_selected() {
$item = $this->event->find('first', 'id=' . $this->params['id']);
if ($item && $item->is_recurring == 1) {
$event_remaining = false;
$eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id);
foreach ($eventdates as $ed) {
if (array_key_exists($ed->id, $this->params['dates'])) {
$ed->delete();
} else {
$event_remaining = true;
}
}
if (!$event_remaining) {
$item->delete(); // model will also ensure we delete all event dates
}
expHistory::back();
} else {
notfoundController::handle_not_found();
}
}
| Base | 1 |
public function setObjectSrc(Response $response)
{
if (config('app.allow_content_scripts')) {
return;
}
$response->headers->set('Content-Security-Policy', 'object-src \'self\'', false);
} | Base | 1 |
function prepareInputForAdd($input) {
//If it's the first ldap directory then set it as the default directory
if (!self::getNumberOfServers()) {
$input['is_default'] = 1;
}
if (isset($input["rootdn_passwd"]) && !empty($input["rootdn_passwd"])) {
$input["rootdn_passwd"] = Toolbox::encrypt(stripslashes($input["rootdn_passwd"]), GLPIKEY);
}
return $input;
} | Class | 2 |
private static function notifyAction()
{
if (! wCMS::$loggedIn) {
return;
}
if (! wCMS::$currentPageExists) {
wCMS::alert('info', '<b>This page (' . wCMS::$currentPage . ') doesn\'t exist.</b> Click inside the content below to create it.');
}
if (wCMS::get('config', 'login') === 'loginURL') {
wCMS::alert('warning', 'Change the default admin login URL. (<i>Settings -> Security</i>)', true);
}
if (password_verify('admin', wCMS::get('config', 'password'))) {
wCMS::alert('danger', 'Change the default password. (<i>Settings -> Security</i>)', true);
}
$repoVersion = wCMS::getOfficialVersion();
if ($repoVersion != version) {
wCMS::alert('info', '<b>New WonderCMS update available.</b><p>- Backup your website and check <a href="https://wondercms.com/whatsnew" target="_blank">what\'s new</a> before updating.</p><form action="' . wCMS::url(wCMS::$currentPage) . '" method="post" class="marginTop5"><button type="submit" class="btn btn-info" name="backup">Create backup</button><input type="hidden" name="token" value="' . wCMS::generateToken() . '"></form><form action="" method="post" class="marginTop5"><button class="btn btn-info" name="upgrade">Update WonderCMS</button><input type="hidden" name="token" value="' . wCMS::generateToken() . '"></form>', true);
}
}
| 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 |
function searchName() {
return gt("Calendar Event");
}
| Base | 1 |
public function save()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) {
if ($this->categoryModel->create($values) !== false) {
$this->flash->success(t('Your category have been created successfully.'));
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);
return;
} else {
$errors = array('name' => array(t('Another category with the same name exists in this project')));
}
}
$this->create($values, $errors);
} | Base | 1 |
public function setPassword(Request $request, string $token)
{
$this->validate($request, [
'password' => ['required', 'min:8'],
]);
try {
$userId = $this->inviteService->checkTokenAndGetUserId($token);
} catch (Exception $exception) {
return $this->handleTokenException($exception);
}
$user = $this->userRepo->getById($userId);
$user->password = bcrypt($request->get('password'));
$user->email_confirmed = true;
$user->save();
$this->inviteService->deleteByUser($user);
$this->showSuccessNotification(trans('auth.user_invite_success', ['appName' => setting('app-name')]));
$this->loginService->login($user, auth()->getDefaultDriver());
return redirect('/');
} | Compound | 4 |
public function confirm()
{
$task = $this->getTask();
$link_id = $this->request->getIntegerParam('link_id');
$link = $this->taskExternalLinkModel->getById($link_id);
if (empty($link)) {
throw new PageNotFoundException();
}
$this->response->html($this->template->render('task_external_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | Base | 1 |
public function disable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | 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 |
$iloc = expUnserialize($container->internal);
if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) {
// There is no sectionref for this container. Populate sectionref
if ($container->external != "N;") {
$newSecRef = new stdClass();
$newSecRef->module = $iloc->mod;
$newSecRef->source = $iloc->src;
$newSecRef->internal = '';
$newSecRef->refcount = 1;
// $newSecRef->is_original = 1;
$eloc = expUnserialize($container->external);
// $section = $db->selectObject('sectionref',"module='containermodule' AND source='".$eloc->src."'");
$section = $db->selectObject('sectionref',"module='container' AND source='".$eloc->src."'");
if (!empty($section)) {
$newSecRef->section = $section->id;
$db->insertObject($newSecRef,"sectionref");
$missing_sectionrefs[] = gt("Missing sectionref for container replaced").": ".$iloc->mod." - ".$iloc->src." - PageID #".$section->id;
} else {
$db->delete('container','id="'.$container->id.'"');
$missing_sectionrefs[] = gt("Cant' find the container page for container").": ".$iloc->mod." - ".$iloc->src.' - '.gt('deleted');
}
}
}
}
assign_to_template(array(
'missing_sectionrefs'=>$missing_sectionrefs,
));
} | Base | 1 |
public function testGetEventsPublicProfile(){
TestingAuxLib::loadX2NonWebUser ();
TestingAuxLib::suLogin ('testuser');
Yii::app()->settings->historyPrivacy = null;
$lastEventId=0;
$lastTimestamp=0;
$myProfile = Profile::model()->findByAttributes(array('username' => 'testuser2'));
$events=Events::getEvents(
$lastEventId,$lastTimestamp,null,$myProfile, false);
$this->assertEquals (
array_map (
function ($event) { return $event->id; },
Events::model ()->findAllByAttributes (array (
'user' => 'testuser2',
'visibility' => 1
))
),
array_map (function ($event) { return $event->id; }, $events['events']));
TestingAuxLib::restoreX2WebUser ();
} | Class | 2 |
public function remove($transaction = true)
{
global $emitter;
try {
if ($transaction) {
$this->zdb->connection->beginTransaction();
}
$delete = $this->zdb->delete(self::TABLE);
$delete->where(self::PK . ' = ' . $this->_id);
$del = $this->zdb->execute($delete);
if ($del->count() > 0) {
$this->updateDeadline();
$this->dynamicsRemove(true);
} else {
Analog::log(
'Contribution has not been removed!',
Analog::WARNING
);
return false;
}
if ($transaction) {
$this->zdb->connection->commit();
}
$emitter->emit('contribution.remove', $this);
return true;
} catch (Throwable $e) {
if ($transaction) {
$this->zdb->connection->rollBack();
}
Analog::log(
'An error occurred trying to remove contribution #' .
$this->_id . ' | ' . $e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | Base | 1 |
public function destroy(Image $image)
{
$this->destroyImagesFromPath($image->path);
$image->delete();
} | Base | 1 |
public function __construct()
{
parent::__construct();
$this->exposeMethod('getOwners');
$this->exposeMethod('getReference');
$this->exposeMethod('getUserRole');
$this->exposeMethod('verifyPhoneNumber');
$this->exposeMethod('findAddress');
$this->exposeMethod('verifyIsHolidayDate');
$this->exposeMethod('changeFavoriteOwner');
} | Base | 1 |
function __construct()
{
# code...
self::$smtphost = Options::get('smtphost');
self::$smtpuser = Options::get('smtpuser');
self::$smtppass = Options::get('smtppass');
self::$smtpssl = Options::get('smtpssl');
self::$siteemail = Options::get('siteemail');
self::$sitename = Options::get('sitename');
} | Compound | 4 |
public function save()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) {
if ($this->categoryModel->create($values) !== false) {
$this->flash->success(t('Your category have been created successfully.'));
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);
return;
} else {
$errors = array('name' => array(t('Another category with the same name exists in this project')));
}
}
$this->create($values, $errors);
} | Base | 1 |
$field_id = Symphony::Database()->fetchVar('id', 0, sprintf(
"SELECT `f`.`id`
FROM `tbl_fields` AS `f`, `tbl_sections` AS `s`
WHERE `s`.`id` = `f`.`parent_section`
AND f.`element_name` = '%s'
AND `s`.`handle` = '%s'
LIMIT 1",
$handle,
$section->get('handle'))
);
$field = $entryManager->fieldManager->fetch($field_id);
if($field instanceof Field) {
// For deprecated reasons, call the old, typo'd function name until the switch to the
// properly named buildDSRetrievalSQL function.
$field->buildDSRetrivalSQL(array($value), $joins, $where, false);
$filter_querystring .= sprintf("filter[%s]=%s&", $handle, rawurlencode($value));
$prepopulate_querystring .= sprintf("prepopulate[%d]=%s&", $field_id, rawurlencode($value));
} else {
unset($filters[$i]);
}
} | Base | 1 |
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));
$ret .= scan_container($cLoc, $page->id);
$ret .= scan_page($page->id);
}
| Base | 1 |
public static function meta($cont_title='', $cont_desc='', $pre =''){
global $data;
//print_r($data);
//if(empty($data['posts'][0]->title)){
if(is_array($data) && isset($data['posts'][0]->title)){
$sitenamelength = strlen(Options::get('sitename'));
$limit = 70-$sitenamelength-6;
$cont_title = substr(Typo::Xclean(Typo::strip($data['posts'][0]->title)),0,$limit);
$titlelength = strlen($data['posts'][0]->title);
if($titlelength > $limit+3) { $dotted = "...";} else {$dotted = "";}
$cont_title = "{$pre} {$cont_title}{$dotted} - ";
}else{
$cont_title = "";
}
if(is_array($data) && isset($data['posts'][0]->content)){
$desc = Typo::strip($data['posts'][0]->content);
}else{
$desc = "";
}
$meta = "
<!--// Start Meta: Generated Automaticaly by GeniXCMS -->
<!-- SEO: Title stripped 70chars for SEO Purpose -->
<title>{$cont_title}".Options::get('sitename')."</title>
<meta name=\"Keyword\" content=\"".Options::get('sitekeywords')."\">
<!-- SEO: Description stripped 150chars for SEO Purpose -->
<meta name=\"Description\" content=\"".self::desc($desc)."\">
<meta name=\"Author\" content=\"Puguh Wijayanto | MetalGenix IT Solutions - www.metalgenix.com\">
<meta name=\"Generator\" content=\"GeniXCMS\">
<meta name=\"robots\" content=\"".Options::get('robots')."\">
<meta name=\"revisit-after\" content=\" days\">
<link rel=\"shortcut icon\" href=\"".Options::get('siteicon')."\" />
";
$meta .= "
<!-- Generated Automaticaly by GeniXCMS :End Meta //-->";
echo $meta;
} | Compound | 4 |
public static function vulnerableExtensions(){
return '/^.*\.('.implode('|',["php","php5","php7","phar","phtml"]).')$/i';
} | Base | 1 |
array_push($stack, $node);
}
}
return array(
'status' => 'success',
'nodes' => $nodes);
} else {
return array(
'status' => 'error',
'errorcode' => 56,
'errormsg' => 'User cannot access node content');
}
} | Class | 2 |
function edit_freeform() {
$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 static function lang($vars) {
$file = GX_PATH.'/inc/lang/'.$vars.'.lang.php';
if (file_exists($file)) {
include($file);
}
}
| Base | 1 |
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
| Class | 2 |
$contents = ['form' => tep_draw_form('customer_data_groups', 'customer_data_groups.php', 'page=' . $_GET['page'] . '&action=insert')]; | Base | 1 |
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();
}
}
| Base | 1 |
public static function login() {
user::login(expString::sanitize($_POST['username']),expString::sanitize($_POST['password']));
if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in
flash('error', gt('Invalid Username / Password'));
if (expSession::is_set('redirecturl_error')) {
$url = expSession::get('redirecturl_error');
expSession::un_set('redirecturl_error');
header("Location: ".$url);
} else {
expHistory::back();
}
} else { // we're logged in
global $user;
if (expSession::get('customer-login')) expSession::un_set('customer-login');
if (!empty($_POST['username'])) flash('message', gt('Welcome back').' '.expString::sanitize($_POST['username']));
if ($user->isAdmin()) {
expHistory::back();
} else {
foreach ($user->groups as $g) {
if (!empty($g->redirect)) {
$url = URL_FULL.$g->redirect;
break;
}
}
if (isset($url)) {
header("Location: ".$url);
} else {
expHistory::back();
}
}
}
} | Base | 1 |
public static function getLatestVersion ($now) {
$v = file_get_contents("https://raw.githubusercontent.com/semplon/GeniXCMS/master/VERSION");
$arr = array(
'version' => trim($v),
'last_check' => $now
);
$arr = json_encode($arr);
Options::update('system_check', $arr);
return $v;
}
| 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
));
} | Base | 1 |
function showallSubcategories() {
// global $db;
expHistory::set('viewable', $this->params);
// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');
$catid = expSession::get('catid');
$parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0);
$category = new storeCategory($parent);
$categories = $category->getEcomSubcategories();
$ancestors = $category->pathToNode();
assign_to_template(array(
'categories' => $categories,
'ancestors' => $ancestors,
'category' => $category
));
} | Class | 2 |
public function pathTestNoAuthority()
{
return [
// path-rootless
['urn:example:animal:ferret:nose'],
// path-absolute
['urn:/example:animal:ferret:nose'],
['urn:/'],
// path-empty
['urn:'],
['urn'],
];
} | Base | 1 |
public function update()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
if ($valid) {
if ($this->swimlaneModel->update($values['id'], $values)) {
$this->flash->success(t('Swimlane updated successfully.'));
return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} else {
$errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
}
}
return $this->edit($values, $errors);
} | Base | 1 |
protected function renderImageByImagick($code)
{
$backColor = $this->transparent ? new \ImagickPixel('transparent') : new \ImagickPixel('#' . str_pad(dechex($this->backColor), 6, 0, STR_PAD_LEFT));
$foreColor = new \ImagickPixel('#' . str_pad(dechex($this->foreColor), 6, 0, STR_PAD_LEFT));
$image = new \Imagick();
$image->newImage($this->width, $this->height, $backColor);
$draw = new \ImagickDraw();
$draw->setFont($this->fontFile);
$draw->setFontSize(30);
$fontMetrics = $image->queryFontMetrics($draw, $code);
$length = strlen($code);
$w = (int) $fontMetrics['textWidth'] - 8 + $this->offset * ($length - 1);
$h = (int) $fontMetrics['textHeight'] - 8;
$scale = min(($this->width - $this->padding * 2) / $w, ($this->height - $this->padding * 2) / $h);
$x = 10;
$y = round($this->height * 27 / 40);
for ($i = 0; $i < $length; ++$i) {
$draw = new \ImagickDraw();
$draw->setFont($this->fontFile);
$draw->setFontSize((int) (mt_rand(26, 32) * $scale * 0.8));
$draw->setFillColor($foreColor);
$image->annotateImage($draw, $x, $y, mt_rand(-10, 10), $code[$i]);
$fontMetrics = $image->queryFontMetrics($draw, $code[$i]);
$x += (int) $fontMetrics['textWidth'] + $this->offset;
}
$image->setImageFormat('png');
return $image->getImageBlob();
} | Class | 2 |
public static function _date2timestamp( $datetime, $wtz=null ) {
if( !isset( $datetime['hour'] )) $datetime['hour'] = 0;
if( !isset( $datetime['min'] )) $datetime['min'] = 0;
if( !isset( $datetime['sec'] )) $datetime['sec'] = 0;
if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || empty( $datetime['tz'] )))
return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
$output = $offset = 0;
if( empty( $wtz )) {
if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) {
$offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1;
$wtz = 'UTC';
}
else
$wtz = $datetime['tz'];
}
if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz )))
$wtz = 'UTC';
try {
$strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] );
$d = new DateTime( $strdate, new DateTimeZone( $wtz ));
if( 0 != $offset ) // adjust for offset
$d->modify( $offset.' seconds' );
$output = $d->format( 'U' );
unset( $d );
}
catch( Exception $e ) {
$output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
}
return $output;
}
| Base | 1 |
public function testCanGiveCustomReason()
{
$r = new Response(200, [], null, '1.1', 'bar');
$this->assertEquals('bar', $r->getReasonPhrase());
} | Base | 1 |
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 testStartedOutside()
{
$storage = $this->getStorage();
$this->assertFalse($storage->getSaveHandler()->isActive());
$this->assertFalse($storage->isStarted());
session_start();
$this->assertTrue(isset($_SESSION));
if (PHP_VERSION_ID >= 50400) {
// this only works in PHP >= 5.4 where session_status is available
$this->assertTrue($storage->getSaveHandler()->isActive());
}
// PHP session might have started, but the storage driver has not, so false is correct here
$this->assertFalse($storage->isStarted());
$key = $storage->getMetadataBag()->getStorageKey();
$this->assertFalse(isset($_SESSION[$key]));
$storage->start();
} | Base | 1 |
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;
}
} | Base | 1 |
public static function data($vars){
$file = GX_THEME.'/'.$vars.'/themeinfo.php';
$handle = fopen($file, 'r');
$data = fread($handle, filesize($file));
fclose($handle);
preg_match('/\* Name: (.*)\n\*/U', $data, $matches);
$d['name'] = $matches[1];
preg_match('/\* Desc: (.*)\n\*/U', $data, $matches);
$d['desc'] = $matches[1];
preg_match('/\* Version: (.*)\n\*/U', $data, $matches);
$d['version'] = $matches[1];
preg_match('/\* Build: (.*)\n\*/U', $data, $matches);
$d['build'] = $matches[1];
preg_match('/\* Developer: (.*)\n\*/U', $data, $matches);
$d['developer'] = $matches[1];
preg_match('/\* URI: (.*)\n\*/U', $data, $matches);
$d['url'] = $matches[1];
preg_match('/\* License: (.*)\n\*/U', $data, $matches);
$d['license'] = $matches[1];
preg_match('/\* Icon: (.*)\n\*/U', $data, $matches);
$d['icon'] = $matches[1];
return $d;
}
| Base | 1 |
public function autocomplete() {
return;
global $db;
$model = $this->params['model'];
$mod = new $model();
$srchcol = explode(",",$this->params['searchoncol']);
/*for ($i=0; $i<count($srchcol); $i++) {
if ($i>=1) $sql .= " OR ";
$sql .= $srchcol[$i].' LIKE \'%'.$this->params['query'].'%\'';
}*/
// $sql .= ' AND parent_id=0';
//eDebug($sql);
//$res = $mod->find('all',$sql,'id',25);
$sql = "select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from ".$db->prefix."product as p INNER JOIN ".$db->prefix."content_expfiles as cef ON p.id=cef.content_id INNER JOIN ".$db->prefix."expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') desc LIMIT 25";
//$res = $db->selectObjectsBySql($sql);
//$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`');
$ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res);
$ar->send();
} | Base | 1 |
public function goingForthAndBackStoresFormValuesOfSecondPageAndTriggersValidationOnlyWhenGoingForward() {
$this->browser->request('http://localhost/test/form/simpleform/ThreePageFormWithValidation');
$this->gotoNextFormPage($this->browser->getForm());
$form = $this->browser->getForm();
$form['--three-page-form-with-validation']['text2-1']->setValue('My Text on the second page');
$this->gotoPreviousFormPage($form);
$this->gotoNextFormPage($this->browser->getForm());
$r = $this->gotoNextFormPage($this->browser->getForm());
$this->assertSame(' error', $this->browser->getCrawler()->filterXPath('//*[contains(@class,"error")]//input[@id="three-page-form-with-validation-text2-1"]')->attr('class'));
$form = $this->browser->getForm();
$form['--three-page-form-with-validation']['text2-1']->setValue('42');
$this->gotoNextFormPage($form);
$form = $this->browser->getForm();
$this->assertSame('', $form['--three-page-form-with-validation']['text3-1']->getValue());
} | Class | 2 |
public function display_sdm_thumbnail_meta_box($post) { // Thumbnail upload metabox
$old_thumbnail = get_post_meta($post->ID, 'sdm_upload_thumbnail', true);
$old_value = isset($old_thumbnail) ? $old_thumbnail : '';
_e('Manually enter a valid URL, or click "Select Image" to upload (or choose) the file thumbnail image.', 'simple-download-monitor');
?>
<br /><br />
<input id="sdm_upload_thumbnail" type="text" size="100" name="sdm_upload_thumbnail" value="<?php echo $old_value; ?>" placeholder="http://..." />
<br /><br />
<input id="upload_thumbnail_button" type="button" class="button-primary" value="<?php _e('Select Image', 'simple-download-monitor'); ?>" />
<input id="remove_thumbnail_button" type="button" class="button" value="<?php _e('Remove Image', 'simple-download-monitor'); ?>" />
<br /><br />
<span id="sdm_admin_thumb_preview">
<?php
if (!empty($old_value)) {
?><img id="sdm_thumbnail_image" src="<?php echo $old_value; ?>" style="max-width:200px;" />
<?php
}
?>
</span>
<?php
echo '<p class="description">';
_e('This thumbnail image will be used to create a fancy file download box if you want to use it.', 'simple-download-monitor');
echo '</p>';
wp_nonce_field('sdm_thumbnail_box_nonce', 'sdm_thumbnail_box_nonce_check');
} | Base | 1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.