code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
public static function delete($id){
return Categories::delete($id);
}
| CWE-89 | 0 |
public function sendAsync(RequestInterface $request, array $options = [])
{
// Merge the base URI into the request URI if needed.
$options = $this->prepareDefaults($options);
return $this->transfer(
$request->withUri($this->buildUri($request->getUri(), $options)),
$options
);
} | CWE-89 | 0 |
public function update() {
//populate the alt tag field if the user didn't
if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title'];
// call expController update to save the image
parent::update();
} | CWE-89 | 0 |
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_restriction/show', array(
'status_list' => array(
SubtaskModel::STATUS_TODO => t('Todo'),
SubtaskModel::STATUS_DONE => t('Done'),
),
'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
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);
} | CWE-79 | 1 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-79 | 1 |
protected function getComment()
{
$comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id'));
if (empty($comment)) {
throw new PageNotFoundException();
}
if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) {
throw new AccessForbiddenException();
}
return $comment;
} | CWE-639 | 9 |
$contents = ['form' => tep_draw_form('customer_data_groups', 'customer_data_groups.php', 'page=' . $_GET['page'] . '&action=insert')]; | CWE-79 | 1 |
$dt = date('Y-m-d', strtotime($match));
$sql = par_rep("/'$match'/", "'$dt'", $sql);
}
}
if (substr($sql, 0, 6) == "BEGIN;") {
$array = explode(";", $sql);
foreach ($array as $value) {
if ($value != "") {
$user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']);
if ($user_agent[0] == 'Mozilla') {
$result = $connection->query($value);
}
if (!$result) {
$user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']);
if ($user_agent[0] == 'Mozilla') {
$connection->query("ROLLBACK");
die(db_show_error($sql, _dbExecuteFailed, mysqli_error($connection)));
}
}
}
}
} else {
$user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']);
if ($user_agent[0] == 'Mozilla') {
$result = $connection->query($sql) or die(db_show_error($sql, _dbExecuteFailed, mysqli_error($connection)));
}
}
break;
} | CWE-22 | 2 |
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 |
protected function getSubtask()
{
$subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id'));
if (empty($subtask)) {
throw new PageNotFoundException();
}
return $subtask;
} | CWE-639 | 9 |
public function privateCore(&$response, $user, $permissions)
{
parent::privateCore($response, $user, $permissions);
$this->model = new PageOption();
$this->loadSelectedViewName();
$this->backPage = $this->request->get('url') ?: $this->selectedViewName;
$this->selectedUser = $this->user->admin ? $this->request->get('nick') : $this->user->nick;
$this->loadPageOptions();
$action = $this->request->get('action', '');
switch ($action) {
case 'delete':
$this->deleteAction();
break;
case 'save':
$this->saveAction();
break;
}
} | CWE-79 | 1 |
$pfTaskJob->update($input);
$tasks_id = $data['plugin_glpiinventory_tasks_id'];
}
} else {
// case 2: if not exist, create a new task + taskjob
$this->getFromDB($packages_id);
//Add the new task
$input = [
'name' => '[deploy on demand] ' . $this->fields['name'],
'entities_id' => $computer->fields['entities_id'],
'reprepare_if_successful' => 0,
'is_deploy_on_demand' => 1,
'is_active' => 1,
];
$tasks_id = $pfTask->add($input);
//Add a new job for the newly created task
//and enable it
$input = [
'plugin_glpiinventory_tasks_id' => $tasks_id,
'entities_id' => $computer->fields['entities_id'],
'name' => 'deploy',
'method' => 'deployinstall',
'targets' => '[{"PluginGlpiinventoryDeployPackage":"' . $packages_id . '"}]',
'actors' => exportArrayToDB([['Computer' => $computers_id]]),
'enduser' => exportArrayToDB([$users_id => [$computers_id]]),
];
$pfTaskJob->add($input);
}
//Prepare the task (and only this one)
$pfTask->prepareTaskjobs(['deployinstall'], $tasks_id);
} | 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 function netmountPrepare($options) {
if (!empty($_REQUEST['encoding']) && @iconv('UTF-8', $_REQUEST['encoding'], '') !== false) {
$options['encoding'] = $_REQUEST['encoding'];
if (!empty($_REQUEST['locale']) && @setlocale(LC_ALL, $_REQUEST['locale'])) {
setlocale(LC_ALL, elFinder::$locale);
$options['locale'] = $_REQUEST['locale'];
}
}
$options['statOwner'] = true;
$options['allowChmodReadOnly'] = true;
return $options;
} | CWE-89 | 0 |
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
$str = str_replace("�", "’", $str);
$str = str_replace("�", "‘", $str);
$str = str_replace("�", "®", $str);
$str = str_replace("�", "-", $str);
$str = str_replace("�", "—", $str);
$str = str_replace("�", "”", $str);
$str = str_replace("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
$str = str_replace("\t", " ", $str);
$str = str_replace(",", "\,", $str);
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
if (!$isHTML) {
$str = str_replace('\"', """, $str);
$str = str_replace('"', """, $str);
} else {
$str = str_replace('"', '""', $str);
}
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
$str = trim(str_replace("�", "™", $str));
//echo "2<br>"; eDebug($str,die);
return $str;
} | CWE-89 | 0 |
public function rules()
{
return [
'upload_receipt' => [
'nullable',
new Base64Mime(['gif', 'jpg', 'png'])
]
];
} | CWE-434 | 5 |
public function save()
{
global $DB;
if(!empty($this->id))
return $this->update();
else
return $this->insert();
}
| CWE-79 | 1 |
private function createMongoCollectionMock()
{
$collection = $this->getMockBuilder('MongoCollection')
->disableOriginalConstructor()
->getMock();
return $collection;
} | CWE-89 | 0 |
protected function configure() {
parent::configure();
if (($tmp = $this->options['tmpPath'])) {
if (!file_exists($tmp)) {
if (@mkdir($tmp)) {
@chmod($tmp, $this->options['tmbPathMode']);
}
}
$this->tmpPath = is_dir($tmp) && is_writable($tmp) ? $tmp : false;
}
if (!$this->tmpPath && ($tmp = elFinder::getStaticVar('commonTempPath'))) {
$this->tmpPath = $tmp;
}
if (!$this->tmpPath && $this->tmbPath && $this->tmbPathWritable) {
$this->tmpPath = $this->tmbPath;
}
$this->mimeDetect = 'internal';
} | CWE-89 | 0 |
public function rules() {
$parentRules = parent::rules();
$parentRules[] = array(
'firstName,lastName', 'required', 'on' => 'webForm');
return $parentRules;
} | CWE-79 | 1 |
function get_allowed_files_extensions_for_upload($fileTypes = 'images')
{
$are_allowed = '';
switch ($fileTypes) {
case 'img':
case 'image':
case 'images':
$are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg';
break;
case 'video':
case 'videos':
$are_allowed .= ',avi,asf,mpg,mpeg,mp4,flv,mkv,webm,ogg,wma,mov,wmv';
break;
case 'file':
case 'files':
$are_allowed .= ',doc,docx,pdf,html,js,css,htm,rtf,txt,zip,gzip,rar,cad,xml,psd,xlsx,csv,7z';
break;
case 'documents':
case 'doc':
$are_allowed .= ',doc,docx,pdf,log,msg,odt,pages,rtf,tex,txt,wpd,wps,pps,ppt,pptx,xml,htm,html,xlr,xls,xlsx';
break;
case 'archives':
case 'arc':
case 'arch':
$are_allowed .= ',zip,zipx,gzip,rar,gz,7z,cbr,tar.gz';
break;
case 'all':
$are_allowed .= ',*';
break;
case '*':
$are_allowed .= ',*';
break;
default:
$are_allowed .= ',' . $fileTypes;
}
if($are_allowed){
$are_allowed = explode(',',$are_allowed);
array_unique($are_allowed);
$are_allowed = array_filter($are_allowed);
$are_allowed = implode(',', $are_allowed);
}
return $are_allowed;
} | CWE-79 | 1 |
function selectArraysBySql($sql) {
$res = @mysqli_query($this->connection, $this->injectProof($sql));
if ($res == null)
return array();
$arrays = array();
for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)
$arrays[] = mysqli_fetch_assoc($res);
return $arrays;
} | CWE-89 | 0 |
public static function dropdown($vars) {
return Categories::dropdown($vars);
}
| CWE-89 | 0 |
public static function update($vars) {
if(is_array($vars)) {
//$slug = Typo::slugify($vars['title']);
//$vars = array_merge($vars, array('slug' => $slug));
//print_r($vars);
$id = Typo::int($_GET['id']);
$ins = array(
'table' => 'posts',
'id' => $id,
'key' => $vars
);
$post = Db::update($ins);
Hooks::run('post_sqladd_action', $vars, $id);
$pinger = Options::v('pinger');
if ($pinger != "") {
Pinger::run($pinger);
}
}
return $post;
}
| CWE-89 | 0 |
function searchCategory() {
return gt('Event');
}
| CWE-89 | 0 |
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
));
} | CWE-89 | 0 |
public function editAlt() {
global $user;
$file = new expFile($this->params['id']);
if ($user->id==$file->poster || $user->isAdmin()) {
$file->alt = $this->params['newValue'];
$file->save();
$ar = new expAjaxReply(200, gt('Your alt was updated successfully'), $file);
} else {
$ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it."));
}
$ar->send();
echo json_encode($file); //FIXME we exit before hitting this
} | CWE-89 | 0 |
$instance->schema = ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'}; | CWE-89 | 0 |
private function edebug($str) {
if ($this->Debugoutput == "error_log") {
error_log($str);
} else {
echo $str;
}
} | CWE-79 | 1 |
function critere_where_dist($idb, &$boucles, $crit) {
$boucle = &$boucles[$idb];
if (isset($crit->param[0])) {
$_where = calculer_liste($crit->param[0], $idb, $boucles, $boucle->id_parent);
} else {
$_where = '@$Pile[0]["where"]';
}
if ($crit->cond) {
$_where = "(($_where) ? ($_where) : '')";
}
if ($crit->not) {
$_where = "array('NOT',$_where)";
}
$boucle->where[] = $_where;
} | CWE-94 | 14 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->checkPermission($project, $filter);
if ($this->customFilterModel->remove($filter['id'])) {
$this->flash->success(t('Custom filter removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this custom filter.'));
}
$this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
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;
}
}
| CWE-89 | 0 |
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_restriction/show', array(
'status_list' => array(
SubtaskModel::STATUS_TODO => t('Todo'),
SubtaskModel::STATUS_DONE => t('Done'),
),
'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
protected function _mkdir($path, $name)
{
$path = $this->_joinPath($path, $name);
if ($this->connect->mkdir($path) === false) {
return false;
}
$this->options['dirMode'] && $this->connect->chmod($this->options['dirMode'], $path);
return $path;
} | CWE-78 | 6 |
$q = self::$mysqli->query($vars) ;
if($q === false) {
Control::error('db',"Query failed: ".self::$mysqli->error."<br />\n");
}
}
return $q;
}
| CWE-89 | 0 |
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId());
$this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']);
} | CWE-639 | 9 |
public function setLoggerChannel($channel = 'Organizr', $username = null)
{
if ($this->hasDB()) {
$setLogger = false;
if ($username) {
$username = htmlspecialchars($username);
}
if ($this->logger) {
if ($channel) {
if (strtolower($this->logger->getChannel()) !== strtolower($channel)) {
$setLogger = true;
}
}
if ($username) {
if (strtolower($this->logger->getTraceId()) !== strtolower($channel)) {
$setLogger = true;
}
}
} else {
$setLogger = true;
}
if ($setLogger) {
$channel = $channel ?: 'Organizr';
return $this->setupLogger($channel, $username);
} else {
return $this->logger;
}
}
} | CWE-434 | 5 |
function npgettext($context, $singular, $plural, $number) {
$key = $context . chr(4) . $singular;
$ret = $this->ngettext($key, $plural, $number);
if (strpos($ret, "\004") !== FALSE) {
return $singular;
} else {
return $ret;
}
} | CWE-94 | 14 |
public function get_news_list($howmany) {
$sql = 'SELECT id, subject, body, postedby, UNIX_TIMESTAMP(postdate) AS postdate
FROM ' . TABLE_PREFIX .'news ORDER BY postdate DESC LIMIT '.$howmany;
return DB::get_results($sql);
} | CWE-89 | 0 |
private function getCategory()
{
$category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));
if (empty($category)) {
throw new PageNotFoundException();
}
return $category;
} | CWE-639 | 9 |
public function testBodyConsistent()
{
$r = new Response(200, [], '0');
$this->assertEquals('0', (string)$r->getBody());
} | CWE-89 | 0 |
public function actionGetItems(){
$sql = 'SELECT id, name as value FROM x2_x2leads WHERE name LIKE :qterm ORDER BY name ASC';
$command = Yii::app()->db->createCommand($sql);
$qterm = $_GET['term'].'%';
$command->bindParam(":qterm", $qterm, PDO::PARAM_STR);
$result = $command->queryAll();
echo CJSON::encode($result);
Yii::app()->end();
} | CWE-79 | 1 |
public function delete() {
global $db, $history;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
$require_login = empty($this->params['require_login']) ? 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['id'])) {
flash('error', gt('Missing id for the comment you would like to delete'));
$lastUrl = expHistory::getLast('editable');
}
// delete the note
$simplenote = new expSimpleNote($this->params['id']);
$rows = $simplenote->delete();
// delete the assocication too
$db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']);
// send the user back where they came from.
$lastUrl = expHistory::getLast('editable');
if (!empty($this->params['tab']))
{
$lastUrl .= "#".$this->params['tab'];
}
redirect_to($lastUrl);
} | CWE-89 | 0 |
public static function go($input, $path, $allowed='', $uniq=false, $size='', $width = '', $height = ''){
$filename = Typo::cleanX($_FILES[$input]['name']);
$filename = str_replace(' ', '_', $filename);
if(isset($_FILES[$input]) && $_FILES[$input]['error'] == 0){
if($uniq == true){
$site = Typo::slugify(Options::v('sitename'));
$uniqfile = $site.'-'.sha1(microtime().$filename).'-';
}else{
$uniqfile = '';
}
$extension = pathinfo($_FILES[$input]['name'], PATHINFO_EXTENSION);
$filetmp = $_FILES[$input]['tmp_name'];
$filepath = GX_PATH.$path.$uniqfile.$filename;
if(!in_array(strtolower($extension), $allowed)){
$result['error'] = 'File not allowed';
}else{
if(move_uploaded_file(
$filetmp,
$filepath)
){
$result['filesize'] = filesize($filepath);
$result['filename'] = $uniqfile.$filename;
$result['path'] = $path.$uniqfile.$filename;
$result['filepath'] = $filepath;
$result['fileurl'] = Site::$url.$path.$uniqfile.$filename;
}else{
$result['error'] = 'Cannot upload to directory, please check
if directory is exist or You had permission to write it.';
}
}
}else{
//$result['error'] = $_FILES[$input]['error'];
$result['error'] = '';
}
return $result;
}
| CWE-89 | 0 |
public function editspeed() {
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']);
assign_to_template(array(
'calculator'=>$calc
));
} | CWE-89 | 0 |
private function normalize($str, $opts) {
if ($opts['nfc'] || $opts['nfkc']) {
if (class_exists('Normalizer', false)) {
if ($opts['nfc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_C))
$str = Normalizer::normalize($str, Normalizer::FORM_C);
if ($opts['nfkc'] && ! Normalizer::isNormalized($str, Normalizer::FORM_KC))
$str = Normalizer::normalize($str, Normalizer::FORM_KC);
} else {
if (! class_exists('I18N_UnicodeNormalizer', false)) {
@ include_once 'I18N/UnicodeNormalizer.php';
}
if (class_exists('I18N_UnicodeNormalizer', false)) {
$normalizer = new I18N_UnicodeNormalizer();
if ($opts['nfc'])
$str = $normalizer->normalize($str, 'NFC');
if ($opts['nfkc'])
$str = $normalizer->normalize($str, 'NFKC');
}
}
}
if ($opts['lowercase']) {
$str = strtolower($str);
}
if ($opts['convmap'] && is_array($opts['convmap'])) {
$str = strtr($str, $opts['convmap']);
}
return $str;
} | CWE-89 | 0 |
function _makeExtra($value, $title = '') {
global $THIS_RET;
if ($THIS_RET['WITH_TEACHER_ID'])
$return .= ''._with.': ' . GetTeacher($THIS_RET['WITH_TEACHER_ID']) . '<BR>';
if ($THIS_RET['NOT_TEACHER_ID'])
$return .= ''._notWith.': ' . GetTeacher($THIS_RET['NOT_TEACHER_ID']) . '<BR>';
if ($THIS_RET['WITH_PERIOD_ID'])
$return .= ''._on.': ' . GetPeriod($THIS_RET['WITH_PERIOD_ID']) . '<BR>';
if ($THIS_RET['NOT_PERIOD_ID'])
$return .= ''._notOn.': ' . GetPeriod($THIS_RET['NOT_PERIOD_ID']) . '<BR>';
if ($THIS_RET['PRIORITY'])
$return .= ''._priority.': ' . $THIS_RET['PRIORITY'] . '<BR>';
if ($THIS_RET['MARKING_PERIOD_ID'])
$return .= ''._markingPeriod.': ' . GetMP($THIS_RET['MARKING_PERIOD_ID']) . '<BR>';
return $return;
} | CWE-22 | 2 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-22 | 2 |
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
));
} | CWE-89 | 0 |
public function IsSMTP() {
$this->Mailer = 'smtp';
} | CWE-79 | 1 |
function init_args(&$dbHandler)
{
$argsObj = new stdClass();
$argsObj->doIt = false;
$argsObj->showPlatforms = false;
$argsObj->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
$argsObj->tproject_name = isset($_SESSION['testprojectName']) ? $_SESSION['testprojectName'] : '';
$argsObj->tplan_name = '';
$argsObj->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : 0;
if($argsObj->tplan_id == 0)
{
$argsObj->tplan_id = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : 0;
}
if($argsObj->tplan_id > 0)
{
$tplan_mgr = new testplan($dbHandler);
$tplan_info = $tplan_mgr->get_by_id($argsObj->tplan_id);
$argsObj->tplan_name = $tplan_info['name'];
$argsObj->doIt = $tplan_mgr->count_testcases($argsObj->tplan_id) > 0;
$argsObj->showPlatforms = $tplan_mgr->hasLinkedPlatforms($argsObj->tplan_id);
$getOpt = array('outputFormat' => 'map');
$argsObj->platforms = $tplan_mgr->getPlatforms($argsObj->tplan_id,$getOpt);
unset($tplan_mgr);
}
return $argsObj;
} | CWE-89 | 0 |
public function confirm()
{
$project = $this->getProject();
$swimlane = $this->getSwimlane();
$this->response->html($this->helper->layout->project('swimlane/remove', array(
'project' => $project,
'swimlane' => $swimlane,
)));
} | CWE-639 | 9 |
public static function unsetTransactionPart(Db $zdb, Login $login, $trans_id, $contrib_id)
{
try {
//first, we check if contribution is part of transaction
$c = new Contribution($zdb, $login, (int)$contrib_id);
if ($c->isTransactionPartOf($trans_id)) {
$update = $zdb->update(self::TABLE);
$update->set(
array(Transaction::PK => null)
)->where(
self::PK . ' = ' . $contrib_id
);
$zdb->execute($update);
return true;
} else {
Analog::log(
'Contribution #' . $contrib_id .
' is not actually part of transaction #' . $trans_id,
Analog::WARNING
);
return false;
}
} catch (Throwable $e) {
Analog::log(
'Unable to detach contribution #' . $contrib_id .
' to transaction #' . $trans_id . ' | ' . $e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
public function delete_version() {
if (empty($this->params['id'])) {
flash('error', gt('The version you are trying to delete could not be found'));
}
// get the version
$version = new help_version($this->params['id']);
if (empty($version->id)) {
flash('error', gt('The version you are trying to delete could not be found'));
}
// if we have errors than lets get outta here!
if (!expQueue::isQueueEmpty('error')) expHistory::back();
// delete the version
$version->delete();
expSession::un_set('help-version');
flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.'));
expHistory::back();
} | CWE-89 | 0 |
function phoromatic_error_page($title, $description)
{
echo phoromatic_webui_header(array(''), '');
$box = '<h1>' . $title . '</h1>
<h2>' . $description . '</h2>
<p>To fix this error, try <a onclick="javascript:window.history.back();">returning to the previous page</a>. Still having problems? Consider <a href="https://github.com/phoronix-test-suite/phoronix-test-suite/issues?state=open">opening a GitHub issue report</a>; commercial support customers should contact Phoronix Media.</p><hr /><hr />';
echo phoromatic_webui_box($box);
echo phoromatic_webui_footer();
} | CWE-79 | 1 |
function phoromatic_system_id_to_name($system_id, $aid = false)
{
return phoromatic_server::system_id_to_name($system_id, $aid);
} | CWE-79 | 1 |
$files[$key]->save();
}
// eDebug($files,true);
} | CWE-89 | 0 |
$sloc = expCore::makeLocation('navigation', null, $section->id);
// remove any manage permissions for this page and it's children
// $db->delete('userpermission', "module='navigationController' AND internal=".$section->id);
// $db->delete('grouppermission', "module='navigationController' AND internal=".$section->id);
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
}
}
| CWE-89 | 0 |
public function getPurchaseOrderByJSON() {
if(!empty($this->params['vendor'])) {
$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);
} else {
$purchase_orders = $this->purchase_order->find('all');
}
echo json_encode($purchase_orders);
} | CWE-89 | 0 |
function db_start()
{
global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;
switch ($DatabaseType) {
case 'mysqli':
$connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);
break;
}
// Error code for both.
if ($connection === false) {
switch ($DatabaseType) {
case 'mysqli':
$errormessage = mysqli_error($connection);
break;
}
db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errormessage);
}
return $connection;
} | CWE-22 | 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']),
)));
} | CWE-639 | 9 |
public static function canImportData() {
return true;
}
| CWE-89 | 0 |
public function getQueryGroupby()
{
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return "$R2.id";
} | CWE-89 | 0 |
function manage () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
if(!empty($this->params['vendor'])) {
$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);
} else {
$purchase_orders = $this->purchase_order->find('all');
}
assign_to_template(array(
'purchase_orders'=>$purchase_orders,
'vendors' => $vendors,
'vendor_id' => @$this->params['vendor']
));
} | CWE-89 | 0 |
function edit_internalalias() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
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(),
));
}
| CWE-89 | 0 |
function checkOldRoutes($path) {
$found = false;
$x = count($path);
while ($x) {
$f = sqlfetch(sqlquery("SELECT * FROM bigtree_route_history WHERE old_route = '".implode("/",array_slice($path,0,$x))."'"));
if ($f) {
$old = $f["old_route"];
$new = $f["new_route"];
$found = true;
break;
}
$x--;
}
// If it's in the old routing table, send them to the new page.
if ($found) {
$new_url = $new.substr($_GET["bigtree_htaccess_url"],strlen($old));
BigTree::redirect(WWW_ROOT.$new_url,"301");
}
} | CWE-89 | 0 |
$ds = self::connectToServer($replicate["host"], $replicate["port"],
$ldap_method['rootdn'],
Toolbox::decrypt($ldap_method['rootdn_passwd'], GLPIKEY),
$ldap_method['use_tls'], $ldap_method['deref_option']);
// Test with login and password of the user
if (!$ds
&& !empty($login)) {
$ds = self::connectToServer($replicate["host"], $replicate["port"], $login,
$password, $ldap_method['use_tls'],
$ldap_method['deref_option']);
}
if ($ds) {
return $ds;
}
}
} | CWE-798 | 18 |
public function load_from_resultset($rs)
{
global $DB;
$main = $rs[0];
$this->id = $main->id;
$this->codename = $main->codename;
$this->icon = $main->icon;
$this->lid = $main->lid;
$this->notes = $main->notes;
$this->enabled = $main->enabled;
/*
$DB->query('SELECT function_id
FROM nv_menu_items
WHERE menu_id = '.$this->id.' ORDER BY position ASC');
$this->functions = $DB->result('function_id');
*/
$this->functions = json_decode($main->functions);
if(empty($this->functions)) $this->functions = array();
}
| CWE-79 | 1 |
public function post()
{
$args = $_POST;
foreach ($this->dbFields as $key=>$value) {
if (isset($args[$key])) {
$value = Sanitize::html( $args[$key] );
if ($value==='false') { $value = false; }
elseif ($value==='true') { $value = true; }
settype($value, gettype($this->dbFields[$key]));
$this->db[$key] = $value;
}
}
return $this->save();
} | CWE-434 | 5 |
public function delete() {
global $user;
$count = $this->address->find('count', 'user_id=' . $user->id);
if($count > 1)
{
$address = new address($this->params['id']);
if ($user->isAdmin() || ($user->id == $address->user_id)) {
if ($address->is_billing)
{
$billAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$billAddress->is_billing = true;
$billAddress->save();
}
if ($address->is_shipping)
{
$shipAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$shipAddress->is_shipping = true;
$shipAddress->save();
}
parent::delete();
}
}
else
{
flash("error", gt("You must have at least one address."));
}
expHistory::back();
} | CWE-89 | 0 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
function mso_current_url($absolute = false, $explode = false, $delete_request = false)
{
$url = getinfo('site_protocol') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if ($delete_request) {
// отделим по «?»
$url = explode('?', $url);
$url = $url[0];
}
if ($absolute) return $url;
$url = str_replace(getinfo('site_url'), '', $url);
$url = trim(str_replace('/', ' ', $url));
$url = str_replace(' ', '/', $url);
$url = urldecode($url);
if ($explode) $url = explode('/', $url);
return $url;
}
| CWE-79 | 1 |
public function Load($tree)
{
if (!$tree)
return;
$contents = array();
$treePath = $tree->GetPath();
$args = array();
$args[] = '--full-name';
if ($this->exe->CanShowSizeInTree())
$args[] = '-l';
$args[] = '-t';
$args[] = $tree->GetHash();
$lines = explode("\n", $this->exe->Execute($tree->GetProject()->GetPath(), GIT_LS_TREE, $args));
foreach ($lines as $line) {
if (preg_match("/^([0-9]+) (.+) ([0-9a-fA-F]{40})(\s+[0-9]+|\s+-)?\t(.+)$/", $line, $regs)) {
switch($regs[2]) {
case 'tree':
$data = array();
$data['type'] = 'tree';
$data['hash'] = $regs[3];
$data['mode'] = $regs[1];
$path = $regs[5];
if (!empty($treePath))
$path = $treePath . '/' . $path;
$data['path'] = $path;
$contents[] = $data;
break;
case 'blob':
$data = array();
$data['type'] = 'blob';
$data['hash'] = $regs[3];
$data['mode'] = $regs[1];
$path = $regs[5];
if (!empty($treePath))
$path = $treePath . '/' . $path;
$data['path'] = $path;
$size = trim($regs[4]);
if (!empty($size))
$data['size'] = $size;
$contents[] = $data;
break;
}
}
}
return $contents;
} | CWE-78 | 6 |
public function testConvertsRequestsToStrings()
{
$request = new Psr7\Request('PUT', 'http://foo.com/hi?123', [
'Baz' => 'bar',
'Qux' => ' ipsum'
], 'hello', '1.0');
$this->assertEquals(
"PUT /hi?123 HTTP/1.0\r\nHost: foo.com\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello",
Psr7\str($request)
);
} | CWE-89 | 0 |
return ${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\Rot13EnvVarProcessor())) && false ?: '_'}; | CWE-89 | 0 |
public function edit(Request $request, $id) {
return $this->view('page::admin.page.edit', [
'content_id'=>$id
]);
} | CWE-79 | 1 |
public static function ajax ($vars="", $val='') {
if( isset($vars) && $vars != "" ) {
$file = GX_PATH.'/inc/lib/Control/Ajax/'.$vars.'-ajax.control.php';
if (file_exists($file)) {
include($file);
}else {
self::error('404');
}
}
}
| CWE-89 | 0 |
function edit_externalalias() {
$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(),
));
}
| CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask/remove', array(
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
public function testTransactionSearch()
{
$transactionSearch = $this->gateway->transactionSearch(array(
'startDate' => '2015-01-01',
'endDate' => '2015-12-31'
));
$this->assertInstanceOf('\Omnipay\PayPal\Message\ExpressTransactionSearchRequest', $transactionSearch);
$this->assertInstanceOf('\DateTime', $transactionSearch->getStartDate());
$this->assertInstanceOf('\DateTime', $transactionSearch->getEndDate());
} | CWE-89 | 0 |
function get_filedisplay_views() {
expTemplate::get_filedisplay_views();
$paths = array(
BASE.'framework/modules/common/views/file/',
BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/',
);
$views = array();
foreach ($paths as $path) {
if (is_readable($path)) {
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {
$filename = substr($file, 0, -4);
$views[$filename] = gt($filename);
}
}
}
}
return $views;
} | CWE-89 | 0 |
print '>' . title_trim(null_out_substitutions(htmlspecialchars($form_data[$id])), 75) . "</option>\n";
}
} | CWE-79 | 1 |
public function Reset() {
$this->error = null; // so no confusion is caused
if(!$this->connected()) {
$this->error = array(
"error" => "Called Reset() without being connected");
return false;
}
fputs($this->smtp_conn,"RSET" . $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" => "RSET failed",
"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;
}
return true;
} | CWE-79 | 1 |
public static function all()
{
global $DB;
global $website;
$DB->query('SELECT *
FROM nv_webuser_groups
WHERE website = '.protect($website->id));
return $DB->result();
}
| CWE-89 | 0 |
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 |
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_DELETE, 'fas fa-trash', null, 'primary', null, 'btn-danger xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('reviews.php', 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id), null, null, 'btn-light')]; | CWE-79 | 1 |
public function getFormat($mimeType)
{
if (false !== $pos = strpos($mimeType, ';')) {
$mimeType = substr($mimeType, 0, $pos);
}
if (null === static::$formats) {
static::initializeFormats();
}
foreach (static::$formats as $format => $mimeTypes) {
if (in_array($mimeType, (array) $mimeTypes)) {
return $format;
}
}
} | CWE-89 | 0 |
private function updateDeadline()
{
try {
$due_date = self::getDueDate($this->zdb, $this->_member);
if ($due_date != '') {
$date_fin_update = $due_date;
} else {
$date_fin_update = new Expression('NULL');
}
$update = $this->zdb->update(Adherent::TABLE);
$update->set(
array('date_echeance' => $date_fin_update)
)->where(
Adherent::PK . '=' . $this->_member
);
$this->zdb->execute($update);
return true;
} catch (Throwable $e) {
Analog::log(
'An error occurred updating member ' . $this->_member .
'\'s deadline |' .
$e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
public function load($code)
{
global $DB;
global $website;
// retrieve extension definition from filesystem
if(file_exists(NAVIGATE_PATH.'/plugins/'.$code.'/'.$code.'.plugin'))
$this->definition = @json_decode(file_get_contents(NAVIGATE_PATH.'/plugins/'.$code.'/'.$code.'.plugin'));
debug_json_error('extension: '.$code);
$this->id = null;
$this->website = $website->id;
$this->title = $this->definition->title;
$this->code = $code;
$this->enabled = 1; // default
$this->settings = array(); // default
// now retrieve extension configuration for the active website
$DB->query('
SELECT * FROM nv_extensions
WHERE website = '.protect($this->website).'
AND extension = '.protect($this->code)
);
$row = $DB->first();
if(!empty($row))
{
$this->id = $row->id;
$this->enabled = $row->enabled;
$this->settings = json_decode($row->settings, true);
}
else
{
// get from definition the default values for settings, if any
if(isset($this->definition->options))
{
foreach ($this->definition->options as $option)
{
if (isset($option->dvalue))
{
$this->settings[$option->id] = $option->dvalue;
}
}
}
}
}
| CWE-89 | 0 |
public function handleObjectDeletionFromUserSide($confirm_msg = false, $op='del') {
global $icmsTpl, $impresscms;
$objectid = ( isset($_REQUEST[$this->handler->keyName]) ) ? (int) ($_REQUEST[$this->handler->keyName]) : 0;
$icmsObj = $this->handler->get($objectid);
if ($icmsObj->isNew()) {
redirect_header("javascript:history.go(-1)", 3, _CO_ICMS_NOT_SELECTED);
exit();
}
$confirm = ( isset($_POST['confirm']) ) ? $_POST['confirm'] : 0;
if ($confirm) {
if (!$this->handler->delete($icmsObj)) {
redirect_header($_POST['redirect_page'], 3, _CO_ICMS_DELETE_ERROR . $icmsObj->getHtmlErrors());
exit;
}
redirect_header($_POST['redirect_page'], 3, _CO_ICMS_DELETE_SUCCESS);
exit();
} else {
// no confirm: show deletion condition
if (!$confirm_msg) {
$confirm_msg = _CO_ICMS_DELETE_CONFIRM;
}
ob_start();
icms_core_Message::confirm(array(
'op' => $op,
$this->handler->keyName => $icmsObj->getVar($this->handler->keyName),
'confirm' => 1,
'redirect_page' => $impresscms->urls['previouspage']),
xoops_getenv('SCRIPT_NAME'),
sprintf($confirm_msg ,
$icmsObj->getVar($this->handler->identifierName)),
_CO_ICMS_DELETE
);
$icmspersistable_delete_confirm = ob_get_clean();
$icmsTpl->assign('icmspersistable_delete_confirm', $icmspersistable_delete_confirm);
}
}
| CWE-22 | 2 |
public static function parseAndTrim($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
// global $db;
$str = str_replace("�", "’", $str);
$str = str_replace("�", "‘", $str);
$str = str_replace("�", "®", $str);
$str = str_replace("�", "-", $str);
$str = str_replace("�", "—", $str);
$str = str_replace("�", "”", $str);
$str = str_replace("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
//$str = str_replace(",","\,",$str);
$str = str_replace('\"', """, $str);
$str = str_replace('"', """, $str);
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
// if (DB_ENGINE=='mysqli') {
// $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "™", $str)));
// } elseif(DB_ENGINE=='mysql') {
// $str = @mysql_real_escape_string(trim(str_replace("�", "™", $str)),$db->connection);
// } else {
// $str = trim(str_replace("�", "™", $str));
// }
$str = @expString::escape(trim(str_replace("�", "™", $str)));
//echo "2<br>"; eDebug($str,die);
return $str;
} | CWE-89 | 0 |
$dt = date('Y-m-d', strtotime($match));
$sql = par_rep("/'$match'/", "'$dt'", $sql);
}
}
if (substr($sql, 0, 6) == "BEGIN;") {
$array = explode(";", $sql);
foreach ($array as $value) {
if ($value != "") {
$result = $connection->query($value);
if (!$result) {
$connection->query("ROLLBACK");
die(db_show_error($sql, _dbExecuteFailed, mysql_error()));
}
}
}
} else {
$result = $connection->query($sql) or die(db_show_error($sql, _dbExecuteFailed, mysql_error()));
}
break;
} | CWE-22 | 2 |
public function save_change_password() {
global $user;
$isuser = ($this->params['uid'] == $user->id) ? 1 : 0;
if (!$user->isAdmin() && !$isuser) {
flash('error', gt('You do not have permissions to change this users password.'));
expHistory::back();
}
if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) {
flash('error', gt('The current password you entered is not correct.'));
expHistory::returnTo('editable');
}
//eDebug($user);
$u = new user($this->params['uid']);
$ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']);
//eDebug($u, true);
if (is_string($ret)) {
flash('error', $ret);
expHistory::returnTo('editable');
} else {
$params = array();
$params['is_admin'] = !empty($u->is_admin);
$params['is_acting_admin'] = !empty($u->is_acting_admin);
$u->update($params);
}
if (!$isuser) {
flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.'));
} else {
$user->password = $u->password;
flash('message', gt('Your password has been changed.'));
}
expHistory::back();
} | CWE-89 | 0 |
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 |
static function description() {
return gt("This module is for managing categories in your store.");
} | CWE-89 | 0 |
public function countFoldersInFolder(Folder $folder, $useFilters = true, $recursive = false)
{
$this->assureFolderReadPermission($folder);
$filters = $useFilters ? $this->fileAndFolderNameFilters : [];
return $this->driver->countFoldersInFolder($folder->getIdentifier(), $recursive, $filters);
} | CWE-319 | 8 |
public function confirm()
{
$project = $this->getProject();
$swimlane = $this->getSwimlane();
$this->response->html($this->helper->layout->project('swimlane/remove', array(
'project' => $project,
'swimlane' => $swimlane,
)));
} | CWE-639 | 9 |
public function manage_messages() {
expHistory::set('manageable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status_messages',
'where'=>1,
'limit'=>10,
'order'=>'body',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
//'columns'=>array('Name'=>'title')
));
//eDebug($page);
assign_to_template(array(
'page'=>$page
));
} | CWE-89 | 0 |
public static function DragnDropReRank2() {
global $router, $db;
$id = $router->params['id'];
$page = new section($id);
$old_rank = $page->rank;
$old_parent = $page->parent;
$new_rank = $router->params['position'] + 1; // rank
$new_parent = intval($router->params['parent']);
$db->decrement($page->tablename, 'rank', 1, 'rank>' . $old_rank . ' AND parent=' . $old_parent); // close in hole
$db->increment($page->tablename, 'rank', 1, 'rank>=' . $new_rank . ' AND parent=' . $new_parent); // make room
$params = array();
$params['parent'] = $new_parent;
$params['rank'] = $new_rank;
$page->update($params);
self::checkForSectionalAdmins($id);
expSession::clearAllUsersSessionCache('navigation');
}
| CWE-89 | 0 |
Subsets and Splits