code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
CWE-89
0
print "<option value='" . $device['id'] . "'"; if (get_request_var('host_id') == $device['id']) { print ' selected'; } print '>' . title_trim(htmlspecialchars($device['description'] . ' (' . $device['hostname'] . ')'), 40) . "</option>\n"; } } ?> </select> </td> <?php } else {
CWE-79
1
public static function totalPost($vars) { $posts = Db::result("SELECT `id` FROM `posts` WHERE `type` = '{$vars}'"); $npost = Db::$num_rows; return $npost; }
CWE-89
0
function captureAuthorization() { //eDebug($this->params,true); $order = new order($this->params['id']); /*eDebug($this->params); //eDebug($order,true);*/ //eDebug($order,true); //$billing = new billing(); //eDebug($billing, true); //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id); $calc = $order->billingmethod[0]->billingcalculator->calculator; $calc->config = $order->billingmethod[0]->billingcalculator->config; //$calc = new $calc- //eDebug($calc,true); if (!method_exists($calc, 'delayed_capture')) { flash('error', gt('The Billing Calculator does not support delayed capture')); expHistory::back(); } $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order); if (empty($result->errorCode)) { flash('message', gt('The authorized payment was successfully captured')); expHistory::back(); } else { flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message); expHistory::back(); } }
CWE-89
0
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); $ret = @rename($source, $target) ? $target : false; $ret && clearstatcache(); return $ret; }
CWE-89
0
public function handle($request, Closure $next) { /** @var \Barryvdh\Debugbar\LaravelDebugbar $debugbar */ $debugbar = $this->app['debugbar']; try { return $next($request); } catch (\Exception $ex) { if (!\Request::ajax()) { throw $ex; } $debugbar->addException($ex); $message = $ex instanceof AjaxException ? $ex->getContents() : \October\Rain\Exception\ErrorHandler::getDetailedMessage($ex); return \Response::make($message, $this->getStatusCode($ex), $debugbar->getDataAsHeaders()); } }
CWE-532
28
public function testStartedOutside() { $storage = $this->getStorage(); $this->assertFalse($storage->getSaveHandler()->isActive()); $this->assertFalse($storage->isStarted()); session_start(); $this->assertTrue(isset($_SESSION)); if (PHP_VERSION_ID >= 50400) { // this only works in PHP >= 5.4 where session_status is available $this->assertTrue($storage->getSaveHandler()->isActive()); } // PHP session might have started, but the storage driver has not, so false is correct here $this->assertFalse($storage->isStarted()); $key = $storage->getMetadataBag()->getStorageKey(); $this->assertFalse(isset($_SESSION[$key])); $storage->start(); }
CWE-89
0
function testCommandCategorieExistence ($name = NULL) { global $pearDB, $form; $id = NULL; if (isset($form)) $id = $form->getSubmitValue('cmd_category_id'); $DBRESULT = $pearDB->query("SELECT `category_name`, `cmd_category_id` FROM `command_categories` WHERE `category_name` = '".htmlentities($name, ENT_QUOTES, "UTF-8")."'"); $cat = $DBRESULT->fetchRow(); if ($DBRESULT->numRows() >= 1 && $cat["cmd_category_id"] == $id) return true; else if ($DBRESULT->numRows() >= 1 && $cat["cmd_category_id"] != $id) return false; else return true; }
CWE-89
0
public function create($data) { if ($this->securityController->isWikiHibernated()) { throw new \Exception(_t('WIKI_IN_HIBERNATION')); } // If ID is not set or if it is already used, find a new ID if (!$data['bn_id_nature'] || $this->getOne($data['bn_id_nature'])) { $data['bn_id_nature'] = $this->findNewId(); } return $this->dbService->query('INSERT INTO ' . $this->dbService->prefixTable('nature') . '(`bn_id_nature` ,`bn_ce_i18n` ,`bn_label_nature` ,`bn_template` ,`bn_description` ,`bn_sem_context` ,`bn_sem_type` ,`bn_sem_use_template` ,`bn_condition`)' . ' VALUES (' . $data['bn_id_nature'] . ', "fr-FR", "' . addslashes(_convert($data['bn_label_nature'], YW_CHARSET, true)) . '","' . addslashes(_convert($data['bn_template'], YW_CHARSET, true)) . '", "' . addslashes(_convert($data['bn_description'], YW_CHARSET, true)) . '", "' . addslashes(_convert($data['bn_sem_context'], YW_CHARSET, true)) . '", "' . addslashes(_convert($data['bn_sem_type'], YW_CHARSET, true)) . '", ' . (isset($data['bn_sem_use_template']) ? '1' : '0') . ', "' . addslashes(_convert($data['bn_condition'], YW_CHARSET, true)) . '")');
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 getQueryGroupby() { return "a.per_tracker_artifact_id"; }
CWE-89
0
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
CWE-79
1
public function showall() { expHistory::set('viewable', $this->params); // figure out if should limit the results if (isset($this->params['limit'])) { $limit = $this->params['limit'] == 'none' ? null : $this->params['limit']; } else { $limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10; } $order = isset($this->config['order']) ? $this->config['order'] : 'publish DESC'; // pull the news posts from the database $items = $this->news->find('all', $this->aggregateWhereClause(), $order); // merge in any RSS news and perform the sort and limit the number of posts we return to the configured amount. if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items); // setup the pagination object to paginate the news stories. $page = new expPaginator(array( 'records'=>$items, 'limit'=>$limit, 'order'=>$order, 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'view'=>empty($this->params['view']) ? null : $this->params['view'] )); assign_to_template(array( 'page'=>$page, 'items'=>$page->records, 'rank'=>($order==='rank')?1:0, 'params'=>$this->params, )); }
CWE-89
0
public function offset($offset) { $this->ar_offset = $offset; return $this; }
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
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 __construct(Database $database, $cookiePrefix = '') { parent::__construct($database, TBL_SESSIONS, 'ses'); // determine session id if (array_key_exists(COOKIE_PREFIX . '_SESSION_ID', $_COOKIE)) { $sessionId = $_COOKIE[COOKIE_PREFIX . '_SESSION_ID']; } else { $sessionId = session_id(); } $this->cookieAutoLoginId = $cookiePrefix . '_AUTO_LOGIN_ID'; if (is_int($sessionId)) { $this->readDataById($sessionId); } else { $this->readDataByColumns(array('ses_session_id' => $sessionId)); if ($this->newRecord) { // if PHP session id was commited then store them in that field $this->setValue('ses_session_id', $sessionId); $this->setValue('ses_timestamp', DATETIME_NOW); } } // check for a valid auto login $this->refreshAutoLogin(); }
CWE-613
7
public function test_attachment_updating() { $page = Page::first(); $this->asAdmin(); $this->call('POST', 'attachments/link', [ 'attachment_link_url' => 'https://example.com', 'attachment_link_name' => 'Example Attachment Link', 'attachment_link_uploaded_to' => $page->id, ]); $attachmentId = Attachment::first()->id; $update = $this->call('PUT', 'attachments/' . $attachmentId, [ 'attachment_edit_name' => 'My new attachment name', 'attachment_edit_url' => 'https://test.example.com' ]); $expectedData = [ 'id' => $attachmentId, 'path' => 'https://test.example.com', 'name' => 'My new attachment name', 'uploaded_to' => $page->id ]; $update->assertStatus(200); $this->assertDatabaseHas('attachments', $expectedData); $this->deleteUploads(); }
CWE-79
1
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
public function show($image_name) { $imageFile = storage_path('app/'.str_replace("-","/",$image_name)); if(!is_file($imageFile)){ abort(404); } $image = Image::make($imageFile); if(config('tipask.upload.open_watermark') && $image_name != config('tipask.upload.watermark_image') && str_contains($image_name,'attachments')){ $watermarkImage = storage_path('app/'.str_replace("-","/",config('tipask.upload.watermark_image'))); $image->insert($watermarkImage, 'bottom-right', 15, 10); } $response = response()->make($image->encode('jpg')); $response->header('Content-Type', 'image/jpeg'); $response->header('Expires', date(DATE_RFC822,strtotime(" 7 day"))); $response->header('Cache-Control', 'private, max-age=259200, pre-check=259200'); return $response; }
CWE-494
22
public function approve() { expHistory::set('editable', $this->params); /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet // $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); expHistory::back(); } $comment = new expComment($this->params['id']); assign_to_template(array( 'comment'=>$comment )); }
CWE-89
0
function __construct () { }
CWE-89
0
$method = $this->request->get('_method', $this->query->get('_method', 'POST')); if (\is_string($method)) { $this->method = strtoupper($method); } } } }
CWE-79
1
public static function load() { $op = Db::result("SELECT * FROM `options` ORDER BY `id` ASC"); if(Db::$num_rows > 0){ return $op; }else{ return false; } }
CWE-89
0
protected function _joinPath($dir, $name) { return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name; }
CWE-22
2
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$str); $str = str_replace("&quot;",'"',$str); $str = str_replace("&#39;","'",$str); $str = str_replace("&rsquo;","'",$str); $str = str_replace("&lsquo;","'",$str); $str = str_replace("&#174;","",$str); $str = str_replace("�","-", $str); $str = str_replace("�","-", $str); $str = str_replace("�", '"', $str); $str = str_replace("&rdquo;",'"', $str); $str = str_replace("�", '"', $str); $str = str_replace("&ldquo;",'"', $str); $str = str_replace("\r\n"," ",$str); $str = str_replace("�"," 1/4",$str); $str = str_replace("&#188;"," 1/4", $str); $str = str_replace("�"," 1/2",$str); $str = str_replace("&#189;"," 1/2",$str); $str = str_replace("�"," 3/4",$str); $str = str_replace("&#190;"," 3/4",$str); $str = str_replace("�", "(TM)", $str); $str = str_replace("&trade;","(TM)", $str); $str = str_replace("&reg;","(R)", $str); $str = str_replace("�","(R)",$str); $str = str_replace("&","&amp;",$str); $str = str_replace(">","&gt;",$str); return trim($str); }
CWE-89
0
private static function logoutAction() { if (wCMS::$currentPage === 'logout' && hash_equals($_REQUEST['token'], wCMS::generateToken())) { unset($_SESSION['l'], $_SESSION['i'], $_SESSION['u'], $_SESSION['token']); wCMS::redirect(); } }
CWE-22
2
public static function webuser_comments_count($webuser_id) { global $DB; global $website; $DB->query(' SELECT COUNT(*) AS total FROM nv_comments WHERE website = '.protect($website->id).' AND user = '.protect($webuser_id).' AND status = 0' ); $out = $DB->result('total'); if(is_array($out)) $out = $out[0]; return $out; }
CWE-89
0
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
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
CWE-89
0
public function updateTab($id, $array) { if (!$id || $id == '') { $this->setAPIResponse('error', 'id was not set', 422); return null; } if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $tabInfo = $this->getTabById($id); if ($tabInfo) { $array = $this->checkKeys($tabInfo, $array); } else { $this->setAPIResponse('error', 'No tab info found', 404); return false; } if (array_key_exists('name', $array)) { $array['name'] = htmlspecialchars($array['name']); if ($this->isTabNameTaken($array['name'], $id)) { $this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409); return false; } } if (array_key_exists('default', $array)) { if ($array['default']) { $this->clearTabDefault(); } } $response = [ array( 'function' => 'query', 'query' => array( 'UPDATE tabs SET', $array, 'WHERE id = ?', $id ) ), ]; $this->setAPIResponse(null, 'Tab info updated'); $this->setLoggerChannel('Tab Management'); $this->logger->debug('Edited Tab Info for [' . $tabInfo['name'] . ']'); return $this->processQueries($response); }
CWE-79
1
public function testPrintAction() { $client = $this->getClientForAuthenticatedUser(User::ROLE_TEAMLEAD); $fixture = new InvoiceTemplateFixtures(); $templates = $this->importFixture($fixture); $id = $templates[0]->getId(); $begin = new \DateTime('first day of this month'); $end = new \DateTime('last day of this month'); $fixture = new TimesheetFixtures(); $fixture ->setUser($this->getUserByRole(User::ROLE_TEAMLEAD)) ->setAmount(20) ->setStartDate($begin) ; $this->importFixture($fixture); $this->request($client, '/invoice/'); $this->assertTrue($client->getResponse()->isSuccessful()); $dateRange = $begin->format('Y-m-d') . DateRangeType::DATE_SPACER . $end->format('Y-m-d'); $params = [ 'daterange' => $dateRange, 'projects' => [1], ]; $action = '/invoice/preview/1/' . $id . '?' . http_build_query($params); $this->request($client, $action); $this->assertTrue($client->getResponse()->isSuccessful()); $node = $client->getCrawler()->filter('body'); $this->assertEquals(1, $node->count()); $this->assertEquals('invoice_print', $node->getIterator()[0]->getAttribute('class')); }
CWE-639
9
function prepareInputForUpdate($input) { if (isset($input["rootdn_passwd"])) { if (empty($input["rootdn_passwd"])) { unset($input["rootdn_passwd"]); } else { $input["rootdn_passwd"] = Toolbox::encrypt(stripslashes($input["rootdn_passwd"]), GLPIKEY); } } if (isset($input["_blank_passwd"]) && $input["_blank_passwd"]) { $input['rootdn_passwd'] = ''; } // Set attributes in lower case if (count($input)) { foreach ($input as $key => $val) { if (preg_match('/_field$/', $key)) { $input[$key] = Toolbox::strtolower($val); } } } //do not permit to override sync_field if ($this->isSyncFieldEnabled() && isset($input['sync_field']) && $this->isSyncFieldUsed() ) { if ($input['sync_field'] == $this->fields['sync_field']) { unset($input['sync_field']); } else { Session::addMessageAfterRedirect( __('Synchronization field cannot be changed once in use.'), false, ERROR ); return false; }; } return $input; }
CWE-798
18
public static function remove_all($object_type, $object_id) { global $DB; global $website; $DB->execute(' DELETE FROM nv_notes WHERE website = '.protect($website->id).' AND item_type = '.protect($object_type).' AND item_id = '.protect($object_id).' LIMIT 1' ); return 'true'; }
CWE-89
0
}elseif($k == "error"){ self::error($v); }elseif(!in_array($k, $arr) && $k != 'paging'){
CWE-89
0
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-639
9
function VerifyVariableSchedule_Update($columns) { // $teacher=$columns['TEACHER_ID']; // $secteacher=$columns['SECONDARY_TEACHER_ID']; // if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='') // { // $all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); // } // else // //$all_teacher=($secteacher!=''?$secteacher:''); // $all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); $teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']:$columns['TEACHER_ID']); $secteacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']:$columns['SECONDARY_TEACHER_ID']); // $secteacher=$qr_teachers[1]['SECONDARY_TEACHER_ID']; if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='') $all_teacher=$teacher.($secteacher!=''?','.$secteacher:'');
CWE-22
2
static function displayname() { return gt("e-Commerce Category Manager"); }
CWE-89
0
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
CWE-79
1
self::ajax($v); } else { if (in_array($k, $arr)) { self::incFront($k, $var); } else { self::error('404'); } } } }
CWE-89
0
function show_vendor () { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); $vendor_title = $vendor->title; $state = new geoRegion($vendor->state); $vendor->state = $state->name; //Removed unnecessary fields unset( $vendor->title, $vendor->table, $vendor->tablename, $vendor->classname, $vendor->identifier ); assign_to_template(array( 'vendor_title' => $vendor_title, 'vendor'=>$vendor )); } }
CWE-89
0
function manage() { global $db, $router, $user; expHistory::set('manageable', $router->params); assign_to_template(array( 'canManageStandalones' => self::canManageStandalones(), 'sasections' => $db->selectObjects('section', 'parent=-1'), 'user' => $user, // 'canManagePagesets' => $user->isAdmin(), // 'templates' => $db->selectObjects('section_template', 'parent=0'), )); }
CWE-89
0
function delete_selected() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item && $item->is_recurring == 1) { $event_remaining = false; $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id); foreach ($eventdates as $ed) { if (array_key_exists($ed->id, $this->params['dates'])) { $ed->delete(); } else { $event_remaining = true; } } if (!$event_remaining) { $item->delete(); // model will also ensure we delete all event dates } expHistory::back(); } else { notfoundController::handle_not_found(); } }
CWE-89
0
public static function type($id) { $id = sprintf('%d', $id); if(isset($id)){ $cat = Db::result("SELECT `type` FROM `cat` WHERE `id` = '{$id}' LIMIT 1"); //print_r($cat); if(isset($cat['error'])){ return ''; }else{ return $cat[0]->type; } }else{ echo "No ID Selected"; } //print_r($cat); }
CWE-89
0
private function getStateId(string $state, string $machine) { return $this->getContainer()->get(Connection::class) ->fetchColumn(' SELECT LOWER(HEX(state_machine_state.id)) FROM state_machine_state INNER JOIN state_machine ON state_machine.id = state_machine_state.state_machine_id AND state_machine.technical_name = :machine WHERE state_machine_state.technical_name = :state ', [ 'state' => $state, 'machine' => $machine, ]); }
CWE-918
16
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 get($id) { if (!is_numeric($id)) { $this->errors[] = _T("ID must be an integer!"); return false; } try { $select = $this->zdb->select($this->table); $select->where($this->fpk . '=' . $id); $results = $this->zdb->execute($select); $result = $results->current(); if (!$result) { $this->errors[] = _T("Label does not exist"); return false; } return $result; } catch (Throwable $e) { Analog::log( __METHOD__ . ' | ' . $e->getMessage(), Analog::WARNING ); throw $e; } }
CWE-89
0
private function runCallback() { foreach ($this->records as &$record) { if (isset($record->ref_type)) { $refType = $record->ref_type; if (class_exists($record->ref_type)) { $type = new $refType(); $classinfo = new ReflectionClass($type); if ($classinfo->hasMethod('paginationCallback')) { $item = new $type($record->original_id); $item->paginationCallback($record); } } } } }
CWE-89
0
public function remove() { $project = $this->getProject(); $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { $this->flash->failure(t('Unable to remove this column.')); } $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); }
CWE-639
9
protected function _mkfile($path, $name) { if ($this->tmp) { $path = $this->_joinPath($path, $name); $local = $this->getTempFile(); $res = touch($local) && ftp_put($this->connect, $path, $local, FTP_ASCII); @unlink($local); return $res ? $path : false; } return false; }
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 function update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { $this->flash->success(t('Swimlane updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { $errors = array('name' => array(t('Another swimlane with the same name exists in the project'))); } } return $this->edit($values, $errors); }
CWE-639
9
function manage() { global $db, $router, $user; expHistory::set('manageable', $router->params); assign_to_template(array( 'canManageStandalones' => self::canManageStandalones(), 'sasections' => $db->selectObjects('section', 'parent=-1'), 'user' => $user, // 'canManagePagesets' => $user->isAdmin(), // 'templates' => $db->selectObjects('section_template', 'parent=0'), )); }
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
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar');
CWE-78
6
public function admin_add() { $this->pageTitle = __d('baser', 'テーマアップロード'); $this->subMenuElements = ['themes']; if (!$this->request->is(['post', 'put'])) { return; } if ($this->Theme->isOverPostSize()) { $this->BcMessage->setError( __d( 'baser', '送信できるデータ量を超えています。合計で %s 以内のデータを送信してください。', ini_get('post_max_size') ) ); } if (empty($this->request->data['Theme']['file']['tmp_name'])) { $message = __d('baser', 'ファイルのアップロードに失敗しました。'); if (!empty($this->request->data['Theme']['file']['error']) && $this->request->data['Theme']['file']['error'] == 1) { $message .= __d('baser', 'サーバに設定されているサイズ制限を超えています。'); } $this->BcMessage->setError($message); return; } $name = $this->request->data['Theme']['file']['name']; move_uploaded_file($this->request->data['Theme']['file']['tmp_name'], TMP . $name); App::uses('BcZip', 'Lib'); $BcZip = new BcZip(); if (!$BcZip->extract(TMP . $name, BASER_THEMES)) { $msg = __d('baser', 'アップロードしたZIPファイルの展開に失敗しました。'); $msg .= "\n" . $BcZip->error; $this->BcMessage->setError($msg); return; } unlink(TMP . $name); $this->BcMessage->setInfo('テーマファイル「' . $name . '」を追加しました。'); $this->redirect(['action' => 'index']); }
CWE-78
6
public function renameUser($new_name) { // Rename only if a new name is really new if ($this->userName != $new_name) { // Save old name $old_name = $this->userName; // Rename user $this->userName = $new_name; $this->save(); // Send message about renaming $message = getlocal( "The visitor changed their name <strong>{0}</strong> to <strong>{1}</strong>", array($old_name, $new_name), $this->locale, true ); $this->postMessage(self::KIND_EVENTS, $message); } }
CWE-79
1
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
public function routeGetProvider() { return [ ['/api/articles/', 1, 'articles', 'index', false], ['/api/v1/articles/', 1, 'articles', 'index', false], ['/api/v2/articles/', 2, 'articles', 'index', false], ['/api/articles/5', 1, 'articles', 'get', 5], ['/api/articles/sw123', 1, 'articles', 'get', 'sw123'], ['/api/v1/articles/5', 1, 'articles', 'get', 5], ['/api/v2/articles/5', 2, 'articles', 'get', 5], ]; }
CWE-601
11
public function manage_versions() { expHistory::set('manageable', $this->params); $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); $sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h '; $sql .= 'RIGHT JOIN '.DB_TABLE_PREFIX.'_help_version hv ON h.help_version_id=hv.id GROUP BY hv.version'; $page = new expPaginator(array( 'sql'=>$sql, 'limit'=>30, 'order' => (isset($this->params['order']) ? $this->params['order'] : 'version'), 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'), 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Version')=>'version', gt('Title')=>'title', gt('Current')=>'is_current', gt('# of Docs')=>'num_docs' ), )); assign_to_template(array( 'current_version'=>$current_version, 'page'=>$page )); }
CWE-89
0
function display($output=false) { if ($this->isEmpty()) return '(empty)'; switch ($output) { case 'email': return $this->body; case 'pdf': return Format::clickableurls($this->body); default: return Format::display($this->body, true, !$this->options['balanced']); } }
CWE-918
16
private function resize($src, $srcImgInfo, $maxWidth, $maxHeight, $quality, $preserveExif) { $zoom = min(($maxWidth/$srcImgInfo[0]),($maxHeight/$srcImgInfo[1])); $width = round($srcImgInfo[0] * $zoom); $height = round($srcImgInfo[1] * $zoom); if (class_exists('Imagick', false)) { return $this->resize_imagick($src, $width, $height, $quality, $preserveExif); } else { return $this->resize_gd($src, $width, $height, $quality, $srcImgInfo); } }
CWE-89
0
public function transferPage() { //FIXME Put Import code in here. }
CWE-89
0
private function mail_passthru($to, $subject, $body, $header, $params) { if ( ini_get('safe_mode') || !($this->UseSendmailOptions) ) { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header); } else { $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header, $params); } return $rt; }
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
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0
public static function getList () { $handle = dir(GX_PATH.'/inc/lang/'); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $file = GX_PATH.'/inc/lang/'.$entry; $ext = pathinfo($file, PATHINFO_EXTENSION); if(is_file($file) == true && $ext == 'php'){ $lang[] = $entry; } } } $handle->close(); return $lang; }
CWE-89
0
if ($current_realm_id == -1 || is_realm_allowed($current_realm_id) || !isset($user_auth_realm_filenames{basename($item_url)})) { /* draw normal (non sub-item) menu item */ $item_url = $config['url_path'] . $item_url; if (is_menu_pick_active($item_url)) { print "<li><a role='menuitem' class='pic selected' href='" . htmlspecialchars($item_url) . "'>$item_title</a></li>\n"; } else { print "<li><a role='menuitem' class='pic' href='" . htmlspecialchars($item_url) . "'>$item_title</a></li>\n"; } } } }
CWE-79
1
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 __construct () { Session::start(); self::config('config'); new Db(); new Hooks(); Hooks::run('init'); new Options(); self::lang(Options::v('system_lang')); new Language(); new Site(); new Router(); Vendor::autoload(); Token::create(); Mod::loader(); Theme::loader(); Hooks::attach('admin_page_notif_action', array('System', 'alert')); }
CWE-89
0
private function isFromTrustedProxy() { return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies); }
CWE-89
0
function display($text, $inline_images=true, $balance=true) { // Make showing offsite images optional $text = preg_replace_callback('/<img ([^>]*)(src="http[^"]+")([^>]*)\/>/', function($match) { // Drop embedded classes -- they don't refer to ours $match = preg_replace('/class="[^"]*"/', '', $match); return sprintf('<span %s class="non-local-image" data-%s %s></span>', $match[1], $match[2], $match[3]); }, $text); if ($balance) $text = self::html_balance($text, false); // make urls clickable. $text = Format::clickableurls($text); if ($inline_images) return self::viewableImages($text); return $text; }
CWE-918
16
function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) { if (empty($endtimestamp)) { $date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($timestamp) . ")"; } else { $date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($endtimestamp) . ")"; } if ($multiday) $date_sql .= " OR (" . expDateTime::startOfDayTimestamp($timestamp) . " BETWEEN ".$field." AND dateFinished)"; $date_sql .= ")"; return $date_sql; }
CWE-89
0
public function chapterToContainedHtml(Chapter $chapter) { $pages = $chapter->getVisiblePages(); $pages->each(function ($page) { $page->html = (new PageContent($page))->render(); }); $html = view('chapters.export', [ 'chapter' => $chapter, 'pages' => $pages, 'format' => 'html', ])->render(); return $this->containHtml($html); }
CWE-79
1
function db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '(')); if (!$pos = strpos($row['TYPE'], ',')) $pos = strpos($row['TYPE'], ')'); else $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1); $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos); if ($row['NULL'] != '') $properties[strtoupper($row['FIELD'])]['NULL'] = "Y"; else $properties[strtoupper($row['FIELD'])]['NULL'] = "N"; } break; } return $properties; }
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
public function approve_toggle() { global $history; 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']) ? 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']; $simplenote = new expSimpleNote($this->params['id']); $simplenote->approved = $simplenote->approved == 1 ? 0 : 1; $simplenote->save(); $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
CWE-89
0
public function testSetCallbackNonCallable() { $response = new StreamedResponse(null); $response->setCallback(null); }
CWE-89
0
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
CWE-89
0
public static function mod($var) { self::load($var); }
CWE-89
0
function comments_list($params) { if (!user_can_access('module.comments.index')) { return; } if (!isset($params['content_id'])) { if (isset($params['rel_id']) and isset($params['rel_type'])) { $data = array( 'rel_id' => $params['rel_id'], 'rel_type' => $params['rel_type'], ); } } else { $data = array( 'content_id' => $params['content_id'] ); } if (isset($params['search-keyword']) and $params['search-keyword']) { $kw = $data['keyword'] = $params['search-keyword']; $data['search_in_fields'] = 'comment_name,comment_body,comment_email,comment_website,from_url,comment_subject'; } $data['order_by'] = 'created_at desc'; $comments = $postComments = get_comments($data); if (isset($params['content_id'])) { $content = get_content_by_id($params['content_id']); $content_id = $params['content_id']; } else { $content = false; $content_id = false; } $moderation_is_required = get_option('require_moderation', 'comments') == 'y'; $view_file = $this->views_dir . 'comments_list.php'; $view = new View($view_file); $view->assign('params', $params); $view->assign('comments', $comments); $view->assign('content_id', $content_id); $view->assign('content', $content); $view->assign('moderation_is_required', $moderation_is_required); return $view->display(); }
CWE-94
14
} elseif ($part != '.') { $depath++; }
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 function get_bitly () { $file = urldecode (join ('/', func_get_args ())); $link = $this->controller->absolutize ('/files/' . $file); return BitlyLink::lookup ($link); }
CWE-434
5
$this->headers = ['host' => [$host]] + $this->headers;
CWE-89
0
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ;
CWE-798
18
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
CWE-639
9
foreach ($val as $vkey => $value) { if ($vkey != 'LAST_UPDATED') { if ($vkey != 'UPDATED_BY') { if ($vkey == 'ID') echo '<SCHOOL_ID>' . htmlentities($value) . '</SCHOOL_ID>'; else if ($vkey == 'SYEAR') echo '<SCHOOL_YEAR>' . htmlentities($value) . '</SCHOOL_YEAR>'; else if ($vkey == 'TITLE') echo '<SCHOOL_NAME>' . htmlentities($value) . '</SCHOOL_NAME>'; else if ($vkey == 'WWW_ADDRESS') echo '<URL>' . htmlentities($value) . '</URL>'; else echo '<' . $vkey . '>' . htmlentities($value) . '</' . $vkey . '>'; } } }
CWE-22
2
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
CWE-89
0
public function showImage(string $path) { $path = storage_path('uploads/images/' . $path); if (!file_exists($path)) { throw (new NotFoundException(trans('errors.image_not_found'))) ->setSubtitle(trans('errors.image_not_found_subtitle')) ->setDetails(trans('errors.image_not_found_details')); } return response()->file($path); }
CWE-22
2
public function __construct( CartService $cartService, SalesChannelRepositoryInterface $productRepository, PromotionItemBuilder $promotionItemBuilder, ProductLineItemFactory $productLineItemFactory ) { $this->cartService = $cartService; $this->productRepository = $productRepository; $this->promotionItemBuilder = $promotionItemBuilder; $this->productLineItemFactory = $productLineItemFactory; }
CWE-79
1
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
self::removeLevel($kid->id); } }
CWE-89
0
function GenerateCryptKey($size = "", $secure = false, $numerals = false, $capitalize = false, $ambiguous = false, $symbols = false) { // load library $pwgen = new SplClassLoader('Encryption\PwGen', '../includes/libraries'); $pwgen->register(); $pwgen = new Encryption\PwGen\pwgen(); // init if (!empty($size)) { $pwgen->setLength($size); } if (!empty($secure)) { $pwgen->setSecure($secure); } if (!empty($numerals)) { $pwgen->setNumerals($numerals); } if (!empty($capitalize)) { $pwgen->setCapitalize($capitalize); } if (!empty($ambiguous)) { $pwgen->setAmbiguous($ambiguous); } if (!empty($symbols)) { $pwgen->setSymbols($symbols); } // generate and send back return $pwgen->generate(); }
CWE-434
5
public static function paginated_list($offset, $limit, $order_by_field, $order_by_ascdesc) { global $DB; global $website; $DB->queryLimit( '*', 'nv_block_groups', 'website = '.protect($website->id), $order_by_field.' '.$order_by_ascdesc, $offset, $limit ); $rs = $DB->result(); $total = $DB->foundRows(); return array($rs, $total); }
CWE-89
0
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
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
$cfgSite->setSetting( 'db', $key, $value); } $cfgSite->setSetting( 'site', 'secrethash', substr(md5(time() . ":" . mt_rand()),0,10)); return true; } else { return $Errors; } }
CWE-916
34
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-79
1
public static function is_email($vars){ if(isset($_GET['act']) && $_GET['act'] == 'edit'){ $id = Typo::int($_GET['id']); $where = "AND `id` != '{$id}' "; }else{ $where = ''; } $vars = sprintf('%s', Typo::cleanX($vars)); $sql = sprintf("SELECT * FROM `user` WHERE `email` = '%s' %s", $vars, $where ); $e = Db::result($sql); if(Db::$num_rows > 0){ return false; }else{ return true; } }
CWE-89
0