code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
function cleanCSV($string)
{
$check = '/^[=@]/';
if (!is_numeric($string)) {
$check = '/^[=@+-]/';
}
return preg_replace($check, "", $string);
} | CWE-1236 | 12 |
$this->{$callback[0]}->{$callback[1]}($objPage, $objLayout, $this);
}
}
$headBag = $this->responseContext->get(HtmlHeadBag::class);
// Set the page title and description AFTER the modules have been generated
$this->Template->mainTitle = $objPage->rootPageTitle;
$this->Template->pageTitle = htmlspecialchars($headBag->getTitle());
// Remove shy-entities (see #2709)
$this->Template->mainTitle = str_replace('[-]', '', $this->Template->mainTitle);
$this->Template->pageTitle = str_replace('[-]', '', $this->Template->pageTitle);
// Meta robots tag
$this->Template->robots = $headBag->getMetaRobots();
// Canonical
if ($objPage->enableCanonical)
{
$this->Template->canonical = $headBag->getCanonicalUriForRequest($request);
}
// Fall back to the default title tag
if (!$objLayout->titleTag)
{
$objLayout->titleTag = '{{page::pageTitle}} - {{page::rootPageTitle}}';
}
// Assign the title and description
$this->Template->title = strip_tags(System::getContainer()->get('contao.insert_tag.parser')->replaceInline($objLayout->titleTag));
$this->Template->description = htmlspecialchars($headBag->getMetaDescription());
// Body onload and body classes
$this->Template->onload = trim($objLayout->onload);
$this->Template->class = trim($objLayout->cssClass . ' ' . $objPage->cssClass);
// Execute AFTER the modules have been generated and create footer scripts first
$this->createFooterScripts($objLayout, $objPage);
$this->createHeaderScripts($objPage, $objLayout);
} | CWE-79 | 1 |
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,
)));
} | CWE-639 | 9 |
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,
)));
} | CWE-639 | 9 |
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));
$ret .= scan_container($cLoc, $page->id);
$ret .= scan_page($page->id);
}
| CWE-89 | 0 |
public static function title($id){
$sql = sprintf("SELECT `title` FROM `posts` WHERE `id` = '%d'", $id);
try
{
$r = Db::result($sql);
if(isset($r['error'])){
$title['error'] = $r['error'];
//echo $title['error'];
}else{
$title = $r[0]->title;
}
}
catch (Exception $e)
{
$title = $e->getMessage();
}
return $title;
}
| CWE-89 | 0 |
echo '</SCHOOL_' . htmlentities($i) . '>';
$i++;
}
echo '</SCHOOL_ACCESS>';
// }
echo '</STAFF_' . htmlentities($j) . '>';
$j++;
} | CWE-79 | 1 |
public function getQuerySelect()
{
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return "$R2.id AS `" . $this->field->name . "`";
} | CWE-89 | 0 |
$q->close();
}
self::$num_rows = $n;
return $r;
}
| CWE-89 | 0 |
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,
)));
} | CWE-639 | 9 |
function edit() {
global $user;
/* 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']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
$require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
$require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
$notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['formtitle']))
{
if (empty($this->params['id']))
{
$formtitle = gt("Add New Note");
}
else
{
$formtitle = gt("Edit Note");
}
}
else
{
$formtitle = $this->params['formtitle'];
}
$id = empty($this->params['id']) ? null : $this->params['id'];
$simpleNote = new expSimpleNote($id);
//FIXME here is where we might sanitize the note before displaying/editing it
assign_to_template(array(
'simplenote'=>$simpleNote,
'user'=>$user,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
'formtitle'=>$formtitle,
'content_type'=>$this->params['content_type'],
'content_id'=>$this->params['content_id'],
'tab'=>empty($this->params['tab'])?0:$this->params['tab']
));
} | CWE-89 | 0 |
public function theme_switch() {
if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file
flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));
}
expSettings::change('DISPLAY_THEME_REAL', $this->params['theme']);
expSession::set('display_theme',$this->params['theme']);
$sv = isset($this->params['sv'])?$this->params['sv']:'';
if (strtolower($sv)=='default') {
$sv = '';
}
expSettings::change('THEME_STYLE_REAL',$sv);
expSession::set('theme_style',$sv);
expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme
// $message = (MINIFY != 1) ? "Exponent is now minifying Javascript and CSS" : "Exponent is no longer minifying Javascript and CSS" ;
// flash('message',$message);
$message = gt("You have selected the")." '".$this->params['theme']."' ".gt("theme");
if ($sv != '') {
$message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation');
}
flash('message',$message);
// expSession::un_set('framework');
expSession::set('force_less_compile', 1);
// expTheme::removeSmartyCache();
expSession::clearAllUsersSessionCache();
expHistory::returnTo('manageable');
} | CWE-89 | 0 |
$args['name'][$i] = $this->normalize($name, $opts);
}
} else {
$args['name'] = $this->normalize($args['name'], $opts);
}
}
return true;
} | CWE-89 | 0 |
public function remove($key)
{
$session =& $this->getSessionRef($key);
unset($session);
return $this;
} | CWE-89 | 0 |
$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
));
} | CWE-89 | 0 |
$section = new section(intval($page));
if ($section) {
// self::deleteLevel($section->id);
$section->delete();
}
}
}
| CWE-89 | 0 |
public function getQueryOrderby()
{
$uh = UserHelper::instance();
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return "$R2.ugroup_id";
} | CWE-89 | 0 |
protected function _mkfile($path, $name) {
$path = $this->_joinPath($path, $name);
if (($fp = @fopen($path, 'w'))) {
@fclose($fp);
@chmod($path, $this->options['fileMode']);
clearstatcache();
return $path;
}
return false;
} | CWE-89 | 0 |
$stat = $this->stat($p);
if (!$stat) { // invalid links
continue;
}
if (!empty($stat['hidden']) || !$this->mimeAccepted($stat['mime'], $mimes)) {
continue;
}
$name = $stat['name'];
if ((!$mimes || $stat['mime'] !== 'directory') && $this->stripos($name, $q) !== false) {
$stat['path'] = $this->path($stat['hash']);
if ($this->URL && !isset($stat['url'])) {
$path = str_replace($this->separator, '/', substr($p, strlen($this->root) + 1));
if ($this->encoding) {
$path = str_replace('%2F', '/', rawurlencode($this->convEncIn($path, true)));
}
$stat['url'] = $this->URL . $path;
}
$result[] = $stat;
}
if ($stat['mime'] == 'directory' && $stat['read'] && !isset($stat['alias'])) {
$result = array_merge($result, $this->doSearch($p, $q, $mimes));
}
}
return $result;
} | CWE-89 | 0 |
public function popupnewsitem($id)
{
$query = 'SELECT *
FROM ' . TABLE_PREFIX .'news
WHERE id=' . $id . ' ';
return DB::get_row($query);
} | CWE-89 | 0 |
public static function generated(){
$end_time = microtime(TRUE);
$time_taken = $end_time - $GLOBALS['start_time'];
$time_taken = round($time_taken,5);
echo '<center><small>Page generated in '.$time_taken.' seconds.</small></center>';
}
| CWE-89 | 0 |
public function __construct () {
}
| CWE-89 | 0 |
public static function canView($section) {
global $db;
if ($section == null) {
return false;
}
if ($section->public == 0) {
// Not a public section. Check permissions.
return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id));
} else { // Is public. check parents.
if ($section->parent <= 0) {
// Out of parents, and since we are still checking, we haven't hit a private section.
return true;
} else {
$s = $db->selectObject('section', 'id=' . $section->parent);
return self::canView($s);
}
}
}
| CWE-89 | 0 |
public function store($zdb)
{
try {
$values = array(
self::PK => $this->id,
'model_fields' => serialize($this->fields)
);
if (!isset($this->id) || $this->id == '') {
//we're inserting a new model
unset($values[self::PK]);
$this->creation_date = date("Y-m-d H:i:s");
$values['model_creation_date'] = $this->creation_date;
$insert = $zdb->insert(self::TABLE);
$insert->values($values);
$results = $zdb->execute($insert);
if ($results->count() > 0) {
return true;
} else {
throw new \Exception(
'An error occurred inserting new import model!'
);
}
} else {
//we're editing an existing model
$update = $zdb->update(self::TABLE);
$update->set($values);
$update->where(self::PK . '=' . $this->id);
$zdb->execute($update);
return true;
}
} catch (Throwable $e) {
Analog::log(
'Something went wrong storing import model :\'( | ' .
$e->getMessage() . "\n" . $e->getTraceAsString(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
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')
)));
} | CWE-639 | 9 |
unset($return[$key]);
}
}
break;
}
return @array_change_key_case($return, CASE_UPPER);
} | CWE-22 | 2 |
protected function fsock_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp)
{
$connect_timeout = 3;
$connect_try = 3;
$method = 'GET';
$readsize = 4096;
$ssl = '';
$getSize = null;
$headers = '';
$arr = parse_url($url);
if (!$arr) {
// Bad request
return false;
}
if ($arr['scheme'] === 'https') {
$ssl = 'ssl://';
}
// query
$arr['query'] = isset($arr['query']) ? '?' . $arr['query'] : '';
// port
$port = isset($arr['port']) ? $arr['port'] : '';
$arr['port'] = $port ? $port : ($ssl ? 443 : 80);
$url_base = $arr['scheme'] . '://' . $arr['host'] . ($port ? (':' . $port) : ''); | CWE-78 | 6 |
protected function LoadData()
{
$this->dataLoaded = true;
$args = array();
$args[] = $this->hash;
$args[] = '--no-merges';
$canSkip = true;
if ($this->skip > 0)
$canSkip = $this->exe->CanSkip();
if ($canSkip) {
if ($this->limit > 0) {
$args[] = '--max-count=' . $this->limit;
}
if ($this->skip > 0) {
$args[] = '--skip=' . $this->skip;
}
} else {
if ($this->limit > 0) {
$args[] = '--max-count=' . ($this->limit + $this->skip);
}
} | CWE-78 | 6 |
function delete_option_master() {
global $db;
$masteroption = new option_master($this->params['id']);
// delete any implementations of this option master
$db->delete('option', 'option_master_id='.$masteroption->id);
$masteroption->delete('optiongroup_master_id=' . $masteroption->optiongroup_master_id);
//eDebug($masteroption);
expHistory::back();
} | CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$link = $this->getTaskLink();
$this->response->html($this->template->render('task_internal_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | CWE-639 | 9 |
protected function curl_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
if ($outfp) {
curl_setopt($ch, CURLOPT_FILE, $outfp);
} else {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
}
curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 1);
curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, $redirect_max);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
$result = curl_exec($ch);
$url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
curl_close($ch);
return $outfp ? $outfp : $result;
} | CWE-918 | 16 |
public static function insert($vars) {
if(is_array($vars)) {
$slug = Typo::slugify($vars['title']);
$vars = array_merge($vars, array('slug' => $slug));
//print_r($vars);
$ins = array(
'table' => 'options',
'key' => $vars
);
$post = Db::insert($ins);
}
return $post;
} | CWE-89 | 0 |
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);
} | CWE-639 | 9 |
public static function getParent($id){
$q = self::getId($id);
return $q[0]->parent;
}
| CWE-89 | 0 |
function teampass_decrypt_pw($encrypted, $salt, $rand_key, $itcount = 2072)
{
$encrypted = base64_decode($encrypted);
$pass_salt = substr($encrypted, -64);
$encrypted = substr($encrypted, 0, -64);
$key = teampass_pbkdf2_hash($salt, $pass_salt, $itcount, 16, 32);
$iv = base64_decode(substr($encrypted, 0, 43) . '==');
$encrypted = substr($encrypted, 43);
$mac = substr($encrypted, -64);
$encrypted = substr($encrypted, 0, -64);
if ($mac !== hash_hmac('sha256', $encrypted, $salt)) return null;
return substr(rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $encrypted, 'ctr', $iv), "\0\4"), strlen($rand_key));
} | CWE-89 | 0 |
public static function rss() {
switch (SMART_URL) {
case true:
# code...
$url = Options::get('siteurl')."/rss".GX_URL_PREFIX;
break;
default:
# code...
$url = Options::get('siteurl')."/index.php?rss";
break;
}
return $url;
} | CWE-89 | 0 |
function update_vendor() {
$vendor = new vendor();
$vendor->update($this->params['vendor']);
expHistory::back();
} | CWE-89 | 0 |
public function __construct($handler) {
$this->handler=$handler;
}
| CWE-22 | 2 |
$schedules[$scheduleCode] = $this->model->createScheduleItem($scheduleCode);
}
return $this->schedulesCache = $schedules;
} | CWE-79 | 1 |
public function getQuerySelect()
{
} | CWE-89 | 0 |
function verify(){
echo $_GET['challenge'];
} | CWE-79 | 1 |
function addDiscountToCart() {
// global $user, $order;
global $order;
//lookup discount to see if it's real and valid, and not already in our cart
//this will change once we allow more than one coupon code
$discount = new discounts();
$discount = $discount->getCouponByName($this->params['coupon_code']);
if (empty($discount)) {
flash('error', gt("This discount code you entered does not exist."));
//redirect_to(array('controller'=>'cart', 'action'=>'checkout'));
expHistory::back();
}
//check to see if it's in our cart already
if ($this->isDiscountInCart($discount->id)) {
flash('error', gt("This discount code is already in your cart."));
//redirect_to(array('controller'=>'cart', 'action'=>'checkout'));
expHistory::back();
}
//this should really be reworked, as it shoudn't redirect directly and not return
$validateDiscountMessage = $discount->validateDiscount();
if ($validateDiscountMessage == "") {
//if all good, add to cart, otherwise it will have redirected
$od = new order_discounts();
$od->orders_id = $order->id;
$od->discounts_id = $discount->id;
$od->coupon_code = $discount->coupon_code;
$od->title = $discount->title;
$od->body = $discount->body;
$od->save();
// set this to just the discount applied via this coupon?? if so, when though? $od->discount_total = ??;
flash('message', gt("The discount code has been applied to your cart."));
} else {
flash('error', $validateDiscountMessage);
}
//redirect_to(array('controller'=>'cart', 'action'=>'checkout'));
expHistory::back();
} | CWE-89 | 0 |
function searchName() {
return gt("Calendar Event");
}
| CWE-89 | 0 |
public function execute(&$params){
$options = &$this->config['options'];
$event = new Events;
$notif = new Notification;
$user = $this->parseOption('user', $params);
$type = $this->parseOption('type', $params);
if($type === 'auto'){
if(!isset($params['model']))
return array (false, '');
$notif->modelType = get_class($params['model']);
$notif->modelId = $params['model']->id;
$notif->type = $this->getNotifType();
$event->associationType = get_class($params['model']);
$event->associationId = $params['model']->id;
$event->type = $this->getEventType();
if($params['model']->hasAttribute('visibility'))
$event->visibility = $params['model']->visibility;
// $event->user = $this->parseOption('user',$params);
} else{
$text = $this->parseOption('text', $params);
$notif->type = 'custom';
$notif->text = $text;
$event->type = 'feed';
$event->subtype = $type;
$event->text = $text;
if($user == 'auto' && isset($params['model']) &&
$params['model']->hasAttribute('assignedTo') &&
!empty($params['model']->assignedTo)){
$event->user = $params['model']->assignedTo;
}elseif(!empty($user)){
$event->user = $user;
}else{
$event->user = 'admin';
}
}
if(!$this->parseOption('createNotif', $params)) {
if (!$notif->save()) {
return array(false, array_shift($notif->getErrors()));
}
}
if ($event->save()) {
return array (true, "");
} else {
return array(false, array_shift($event->getErrors()));
}
} | CWE-79 | 1 |
public static function regdate($id){
$usr = Db::result(
sprintf("SELECT * FROM `user` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1",
Typo::int($id),
Typo::cleanX($id)
)
);
return $usr[0]->join_date;
}
| CWE-89 | 0 |
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')
)));
} | CWE-639 | 9 |
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId());
$this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']);
} | CWE-639 | 9 |
function columnUpdate($table, $col, $val, $where=1) {
$res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where");
/*if ($res == null)
return array();
$objects = array();
for ($i = 0; $i < mysqli_num_rows($res); $i++)
$objects[] = mysqli_fetch_object($res);*/
//return $objects;
} | CWE-89 | 0 |
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
));
} | CWE-89 | 0 |
public function showUnpublished() {
expHistory::set('viewable', $this->params);
// setup the where clause for looking up records.
$where = parent::aggregateWhereClause();
$where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where;
if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1';
$page = new expPaginator(array(
'model'=>'news',
'where'=>$where,
'limit'=>25,
'order'=>'unpublish',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title',
gt('Published On')=>'publish',
gt('Status')=>'unpublish'
),
));
assign_to_template(array(
'page'=>$page
));
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$DB->query('SELECT * FROM nv_shipping_methods WHERE website = '.protect($website->id), 'object');
$out = $DB->result();
if($type='json')
$out = json_encode($out);
return $out;
}
| CWE-89 | 0 |
recyclebin::sendToRecycleBin($loc, $parent);
//FIXME if we delete the module & sectionref the module completely disappears
// if (class_exists($secref->module)) {
// $modclass = $secref->module;
// //FIXME: more module/controller glue code
// if (expModules::controllerExists($modclass)) {
// $modclass = expModules::getControllerClassName($modclass);
// $mod = new $modclass($loc->src);
// $mod->delete_instance();
// } else {
// $mod = new $modclass();
// $mod->deleteIn($loc);
// }
// }
}
// $db->delete('sectionref', 'section=' . $parent);
$db->delete('section', 'parent=' . $parent);
}
| CWE-89 | 0 |
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql);
foreach ($evs as $key=>$event) {
if ($condense) {
$eventid = $event->id;
$multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;'));
if (!empty($multiday_event)) {
unset($evs[$key]);
continue;
}
}
$evs[$key]->eventstart += $edate->date;
$evs[$key]->eventend += $edate->date;
$evs[$key]->date_id = $edate->id;
if (!empty($event->expCat)) {
$catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color);
// if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';';
$evs[$key]->color = $catcolor;
}
}
if (count($events) < 500) { // magic number to not crash loop?
$events = array_merge($events, $evs);
} else {
// $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!');
// $events = array_merge($events, $evs);
flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'));
break; // keep from breaking system by too much data
}
}
| CWE-89 | 0 |
$ok = $DB->execute('
INSERT INTO nv_paths
(id, website, type, object_id, lang, path, cache_file, cache_expires, views)
VALUES
( 0, :website, :type, :object_id, :lang, :path, "", 0, :views )
',
array(
':website' => $website_id,
':type' => $type,
':object_id' => $object_id,
':lang' => $lang,
':path' => $path,
':views' => 0,
)
);
if(!$ok) throw new Exception($DB->get_last_error());
}
| CWE-89 | 0 |
public static function BBCode2Html($text) {
$text = trim($text);
$text = self::parseEmoji($text);
// Smileys to find...
$in = array(
);
// And replace them by...
$out = array(
);
$in[] = '[/*]';
$in[] = '[*]';
$out[] = '</li>';
$out[] = '<li>';
$text = str_replace($in, $out, $text);
// BBCode to find...
$in = array( '/\[b\](.*?)\[\/b\]/ms',
'/\[i\](.*?)\[\/i\]/ms',
'/\[u\](.*?)\[\/u\]/ms',
'/\[mark\](.*?)\[\/mark\]/ms',
'/\[s\](.*?)\[\/s\]/ms',
'/\[list\=(.*?)\](.*?)\[\/list\]/ms',
'/\[list\](.*?)\[\/list\]/ms',
'/\[\*\]\s?(.*?)\n/ms',
'/\[fs(.*?)\](.*?)\[\/fs(.*?)\]/ms',
'/\[color\=(.*?)\](.*?)\[\/color\]/ms'
);
// And replace them by...
$out = array( '\1',
'\1',
'\1',
'\1',
'\1',
'\2',
'\1',
'\1',
'\2',
'\2'
);
$text = preg_replace($in, $out, $text);
// Prepare quote's
$text = str_replace("\r\n","\n",$text);
// paragraphs
$text = str_replace("\r", "", $text);
return $text;
} | CWE-79 | 1 |
public function event()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id'])) {
return $this->create();
}
return $this->response->html($this->template->render('action_creation/event', array(
'values' => $values,
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | CWE-639 | 9 |
$val = self::escape($val);
$set .= "'{$val}',";
$k .= "`{$key}`,";
}
$set = substr($set, 0,-1);
$k = substr($k, 0,-1);
$sql = sprintf("INSERT INTO `%s` (%s) VALUES (%s) ", $vars['table'], $k, $set) ;
}else{
$sql = $vars;
}
if(DB_DRIVER == 'mysql') {
mysql_query('SET CHARACTER SET utf8');
$q = mysql_query($sql) or die(mysql_error());
self::$last_id = mysql_insert_id();
}elseif(DB_DRIVER == 'mysqli'){
try {
if(!self::query($sql)){
// printf("<div class=\"alert alert-danger\">Errormessage: %s</div>\n", self::$mysqli->error);
//Control::error('db',self::$mysqli->error);
return false;
}else{
self::$last_id = self::$mysqli->insert_id;
return true;
}
} catch (exception $e) {
echo $e->getMessage();
}
}
//return true;
}
| CWE-89 | 0 |
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar'); | CWE-918 | 16 |
private function userAuth()
{
$user = new User();
$nick = $this->request->request->get('fsNick', '');
if ($nick === '') {
return $this->cookieAuth($user);
}
if ($user->loadFromCode($nick) && $user->enabled) {
if ($user->verifyPassword($this->request->request->get('fsPassword'))) {
// Execute actions from User model extensions
$user->pipe('login');
$this->updateCookies($user, true);
ToolBox::ipFilter()->clear();
ToolBox::i18nLog()->debug('login-ok', ['%nick%' => $user->nick]);
ToolBox::log()::setContext('nick', $user->nick);
return $user;
}
$this->ipWarning();
ToolBox::i18nLog()->warning('login-password-fail');
return false;
}
$this->ipWarning();
ToolBox::i18nLog()->warning('login-user-not-found', ['%nick%' => $nick]);
return false;
} | CWE-79 | 1 |
function html_escape_request_var($string) {
return htmlspecialchars(get_request_var($string), ENT_QUOTES, 'UTF-8');
} | CWE-79 | 1 |
protected function _stat($path) {
$sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs
FROM '.$this->tbf.' AS f
LEFT JOIN '.$this->tbf.' AS p ON p.id=f.parent_id
LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.id AND ch.mime="directory"
WHERE f.id="'.$path.'"
GROUP BY f.id';
$res = $this->query($sql);
if ($res) {
$stat = $res->fetch_assoc();
if ($stat['parent_id']) {
$stat['phash'] = $this->encode($stat['parent_id']);
}
if ($stat['mime'] == 'directory') {
unset($stat['width']);
unset($stat['height']);
} else {
unset($stat['dirs']);
}
unset($stat['id']);
unset($stat['parent_id']);
return $stat;
}
return array();
} | CWE-89 | 0 |
function delete_option_master() {
global $db;
$masteroption = new option_master($this->params['id']);
// delete any implementations of this option master
$db->delete('option', 'option_master_id='.$masteroption->id);
$masteroption->delete('optiongroup_master_id=' . $masteroption->optiongroup_master_id);
//eDebug($masteroption);
expHistory::back();
} | CWE-89 | 0 |
public function confirm()
{
$project = $this->getProject();
$this->response->html($this->helper->layout->project('action/remove', array(
'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')),
'available_events' => $this->eventManager->getAll(),
'available_actions' => $this->actionManager->getAvailableActions(),
'project' => $project,
'title' => t('Remove an action')
)));
} | CWE-639 | 9 |
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'])));
} | CWE-639 | 9 |
public function theme_switch() {
if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file
flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.'));
}
expSettings::change('DISPLAY_THEME_REAL', $this->params['theme']);
expSession::set('display_theme',$this->params['theme']);
$sv = isset($this->params['sv'])?$this->params['sv']:'';
if (strtolower($sv)=='default') {
$sv = '';
}
expSettings::change('THEME_STYLE_REAL',$sv);
expSession::set('theme_style',$sv);
expDatabase::install_dbtables(); // update tables to include any custom definitions in the new theme
// $message = (MINIFY != 1) ? "Exponent is now minifying Javascript and CSS" : "Exponent is no longer minifying Javascript and CSS" ;
// flash('message',$message);
$message = gt("You have selected the")." '".$this->params['theme']."' ".gt("theme");
if ($sv != '') {
$message .= ' '.gt('with').' '.$this->params['sv'].' '.gt('style variation');
}
flash('message',$message);
// expSession::un_set('framework');
expSession::set('force_less_compile', 1);
// expTheme::removeSmartyCache();
expSession::clearAllUsersSessionCache();
expHistory::returnTo('manageable');
} | CWE-89 | 0 |
public function confirm()
{
$project = $this->getProject();
$this->response->html($this->helper->layout->project('action/remove', array(
'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')),
'available_events' => $this->eventManager->getAll(),
'available_actions' => $this->actionManager->getAvailableActions(),
'project' => $project,
'title' => t('Remove an action')
)));
} | CWE-639 | 9 |
elseif ( $columns['TITLE'] )
{
$id_new = DBSeqNextID( 'school_marking_periods_marking_period_id_seq' );
$sql = "INSERT INTO SCHOOL_MARKING_PERIODS ";
$fields = "MARKING_PERIOD_ID,MP,SYEAR,SCHOOL_ID,";
$values = "'" . $id_new . "','" . $_REQUEST['mp_term'] . "','" . UserSyear() . "','" . UserSchool() . "',";
switch ( $_REQUEST['mp_term'] )
{
case 'SEM':
$fields .= "PARENT_ID,";
$values .= "'" . $_REQUEST['year_id'] . "',";
break;
case 'QTR':
$fields .= "PARENT_ID,";
$values .= "'" . $_REQUEST['semester_id'] . "',";
break;
case 'PRO':
$fields .= "PARENT_ID,";
$values .= "'" . $_REQUEST['quarter_id'] . "',";
break;
}
$go = false;
foreach ( (array) $columns as $column => $value )
{
if ( $column === 'START_DATE'
|| $column === 'END_DATE'
|| $column === 'POST_START_DATE'
|| $column === 'POST_END_DATE' )
{
//FJ fix SQL bug START_DATE or END_DATE is null
if ( ! VerifyDate( $value )
&& $value !== ''
|| ( ( $column === 'START_DATE'
|| $column === 'END_DATE' )
&& $value === '' ) )
{
$error[] = _( 'Not all of the dates were entered correctly.' );
break 2;
}
//FJ verify END_DATE > START_DATE
if ( ( $column === 'END_DATE'
&& date_create( $value ) <= date_create( $columns['START_DATE'] ) )
|| ( $column === 'POST_START_DATE'
&& $columns['POST_END_DATE'] !== ''
&& date_create( $value ) > date_create( $columns['POST_END_DATE'] ) ) )
{
$error[] = _( 'Start date must be anterior to end date.' );
break 2;
}
}
if ( ! empty( $value )
|| $value === '0' )
{
$fields .= $column . ',';
$values .= "'" . $value . "',";
$go = true;
}
}
$sql .= '(' . mb_substr( $fields, 0, -1 ) . ') values(' . mb_substr( $values, 0, -1 ) . ')';
} | CWE-89 | 0 |
$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();
} | CWE-89 | 0 |
function RemoveXSSchars(&$val)
{
static $patterns = NULL;
static $replacements = NULL;
$val_before = $val;
$found = true;
if ( $patterns == NULL ) {
$patterns = array();
$replacements = array();
// remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are
// allowed this prevents some character re-spacing such as <java\0script>
// note that you have to handle splits with \n, \r, and \t later since they
// *are* allowed in some inputs
$patterns[] = '/([\x00-\x08\x0b-\x0c\x0e-\x19])/';
$replacements[] = '';
// straight replacements, the user should never need these since they're
// normal characters this prevents like
// <IMG SRC=@avascript:alert('XSS')>
// Calculate the search and replace patterns only once
$search = 'abcdefghijklmnopqrstuvwxyz';
$search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$search .= '1234567890!@#$%^&*()';
$search .= '~`";:?+/={}[]-_|\'\\';
for ($i = 0, $istrlen_search = strlen($search); $i < $istrlen_search; $i++) {
// ;? matches the ;, which is optional
// 0{0,8} matches any padded zeros,
// which are optional and go up to 8 chars
// @ @ search for the hex values
$patterns[] = '/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i';
$replacements[] = $search[$i];
// @ @ 0{0,8} matches '0' zero to eight times
// with a ;
$patterns[] = '/(�{0,8}'.ord($search[$i]).';?)/';
$replacements[] = $search[$i];
}
}
$val = preg_replace($patterns, $replacements, $val);
if ($val_before == $val) {
// no replacements were made, so exit the loop
$found = false;
}
return $found;
} | CWE-79 | 1 |
function manage_vendors () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
assign_to_template(array(
'vendors'=>$vendors
));
} | CWE-89 | 0 |
foreach($course_RET as $period_date)
{
// $period_days_append_sql .="(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND IF(course_period_date IS NULL, course_period_date='$period_date[COURSE_PERIOD_DATE]',DAYS LIKE '%$period_date[DAYS]%')) OR ";
$period_days_append_sql .="(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND (cpv.course_period_date IS NULL OR cpv.course_period_date='$period_date[COURSE_PERIOD_DATE]') AND cpv.DAYS LIKE '%$period_date[DAYS]%') OR ";
} | CWE-22 | 2 |
private function _finishUp($callFrom = '') {
$this->logger->setLogInfo('Call from: ' . $callFrom);
if (function_exists('mw_post_update')) {
mw_post_update();
}
$this->logger->setLogInfo('Cleaning up system cache');
mw()->cache_manager->clear();
$zipReader = new ZipReader();
$zipReader->clearCache();
$this->logger->setLogInfo('Done!');
} | CWE-434 | 5 |
public function update_groupdiscounts() {
global $db;
if (empty($this->params['id'])) {
// look for existing discounts for the same group
$existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']);
if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.'));
}
$gd = new groupdiscounts();
$gd->update($this->params);
expHistory::back();
} | CWE-89 | 0 |
protected function _tempdir($dir, $prefix = '', $mode = 0700)
{
if (substr($dir, -1) != DIRECTORY_SEPARATOR) {
$dir .= DIRECTORY_SEPARATOR;
}
do {
$path = $dir.$prefix.mt_rand(0, 9999999);
} while (!mkdir($path, $mode));
return $path;
} | CWE-434 | 5 |
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'])));
} | CWE-639 | 9 |
public static function updatePassword(Db $zdb, $id_adh, $pass)
{
try {
$cpass = password_hash($pass, PASSWORD_BCRYPT);
$update = $zdb->update(self::TABLE);
$update->set(
array('mdp_adh' => $cpass)
)->where(self::PK . ' = ' . $id_adh);
$zdb->execute($update);
Analog::log(
'Password for `' . $id_adh . '` has been updated.',
Analog::DEBUG
);
return true;
} catch (Throwable $e) {
Analog::log(
'An error occurred while updating password for `' . $id_adh .
'` | ' . $e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
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,
)));
} | CWE-639 | 9 |
public function delete($fileName = null)
{
$this->validateFileName();
list($name, $extension) = $this->model->getFileNameParts();
return $this->datasource->delete(
$this->model->getObjectTypeDirName(),
$name,
$extension
);
} | CWE-79 | 1 |
$contents = ['form' => tep_draw_form('rates', 'tax_rates.php', 'page=' . $_GET['page'] . '&action=insert')]; | CWE-79 | 1 |
$row_rub = sql_fetsel("id_rubrique", "spip_rubriques",
"lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=$id_parent");
if ($row_rub) {
$row['id_rubrique'] = $row_rub['id_rubrique'];
}
}
}
}
return $row;
} | CWE-89 | 0 |
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
| CWE-89 | 0 |
return getenv('REMOTE_ADDR');
} else {
return false;
}
} | CWE-89 | 0 |
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ; | CWE-798 | 18 |
public static function html() {
new Xaptcha();
$html = "<div class=\"form-group\">
<div class=\"g-recaptcha\" data-sitekey=\"".self::$key."\"></div></div>
<script type=\"text/javascript\"
src=\"https://www.google.com/recaptcha/api.js?hl=".self::$lang."\" async defer>
</script>";
if (self::isEnable()) {
return $html;
}else{
return '';
}
}
| CWE-89 | 0 |
protected function _move($source, $targetDir, $name)
{
$target = $this->_joinPath($targetDir, $name);
return $this->connect->rename($source, $target) ? $target : false;
} | CWE-78 | 6 |
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']); | CWE-89 | 0 |
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();
} | CWE-89 | 0 |
public static function navtojson() {
return json_encode(self::navhierarchy());
}
| CWE-89 | 0 |
public function read($source) {
$source = $this->escapePath($source);
// close the single quote, open a double quote where we put the single quote...
$source = str_replace('\'', '\'"\'"\'', $source);
// since returned stream is closed by the caller we need to create a new instance
// since we can't re-use the same file descriptor over multiple calls
$command = sprintf('%s --authentication-file=/proc/self/fd/3 //%s/%s -c \'get %s /proc/self/fd/5\'',
Server::CLIENT,
$this->server->getHost(),
$this->name,
$source
);
$connection = new Connection($command);
$connection->writeAuthentication($this->server->getUser(), $this->server->getPassword());
$fh = $connection->getFileOutputStream();
stream_context_set_option($fh, 'file', 'connection', $connection);
return $fh;
} | CWE-78 | 6 |
protected function dataValue() {
return [
['foo', "'foo'"],
['bar', "'bar'"],
['42', "'42'"],
['+33', "'+33'"],
[null, 'NULL'],
['null', 'NULL'],
['NULL', 'NULL'],
['`field`', '`field`'],
['`field', "'`field'"]
];
} | CWE-89 | 0 |
public function pending() {
// global $db;
// make sure we have what we need.
if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));
// find the subscriber and their pending subscriptions
$ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);
$subscriber = new subscribers($this->params['id']);
// render the template
assign_to_template(array(
'subscriber'=>$subscriber,
'ealerts'=>$ealerts
));
} | CWE-89 | 0 |
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;
} | CWE-94 | 14 |
function draw_vdef_preview($vdef_id) {
?>
<tr class='even'>
<td style='padding:4px'>
<pre>vdef=<?php print get_vdef($vdef_id, true);?></pre>
</td>
</tr>
<?php
} | CWE-79 | 1 |
public function pending() {
// global $db;
// make sure we have what we need.
if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.'));
// find the subscriber and their pending subscriptions
$ealerts = expeAlerts::getPendingBySubscriber($this->params['id']);
$subscriber = new subscribers($this->params['id']);
// render the template
assign_to_template(array(
'subscriber'=>$subscriber,
'ealerts'=>$ealerts
));
} | CWE-89 | 0 |
function edit_optiongroup_master() {
expHistory::set('editable', $this->params);
$id = isset($this->params['id']) ? $this->params['id'] : null;
$record = new optiongroup_master($id);
assign_to_template(array(
'record'=>$record
));
} | CWE-89 | 0 |
private function drain(StreamInterface $source, StreamInterface $sink)
{
Psr7\copy_to_stream($source, $sink);
$sink->seek(0);
$source->close();
return $sink;
} | CWE-89 | 0 |
public function destroy(Appointment $appointment)
{
if (!auth()->user()->can("appointment-create")) {
return response("Access denied", 403);
}
$deleted = $appointment->delete();
if ($deleted) {
return response("Success");
}
return response("Error", 503);
} | CWE-521 | 4 |
public function saveconfig() {
global $db;
if (empty($this->params['id'])) return false;
$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);
$calc = new $calcname($this->params['id']);
$conf = serialize($calc->parseConfig($this->params));
$calc->update(array('config'=>$conf));
expHistory::back();
} | CWE-89 | 0 |
function edit() {
global $user;
/* 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']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
$require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
$require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
$notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['formtitle']))
{
if (empty($this->params['id']))
{
$formtitle = gt("Add New Note");
}
else
{
$formtitle = gt("Edit Note");
}
}
else
{
$formtitle = $this->params['formtitle'];
}
$id = empty($this->params['id']) ? null : $this->params['id'];
$simpleNote = new expSimpleNote($id);
//FIXME here is where we might sanitize the note before displaying/editing it
assign_to_template(array(
'simplenote'=>$simpleNote,
'user'=>$user,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
'formtitle'=>$formtitle,
'content_type'=>$this->params['content_type'],
'content_id'=>$this->params['content_id'],
'tab'=>empty($this->params['tab'])?0:$this->params['tab']
));
} | CWE-89 | 0 |
function lockTable($table,$lockType="WRITE") {
$sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType";
$res = mysqli_query($this->connection, $sql);
return $res;
} | CWE-89 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.