code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
protected function getFooService()
{
return $this->services['Bar\Foo'] = new \Bar\Foo();
} | CWE-89 | 0 |
public function withFragment($fragment)
{
if (substr($fragment, 0, 1) === '#') {
$fragment = substr($fragment, 1);
}
$fragment = $this->filterQueryAndFragment($fragment);
if ($this->fragment === $fragment) {
return $this;
}
$new = clone $this;
$new->fragment = $fragment;
return $new;
} | CWE-89 | 0 |
public function search($q, $page=''){
$q = str_replace(' ', '+', trim($q));
if(isset($page) && $page !=''){
$page = "&page=".$page;
}else{
$page = "";
}
$url = "http://api.themoviedb.org/3/search/movie?query=".$q."&api_key=".$this->apikey.$page;
$search = $this->curl($url);
//echo $search;
return $search;
}
| CWE-89 | 0 |
public function testGetConfigWithBrokenSystem() {
$slideshow = true;
$exceptionMessage = 'Aïe!';
$this->configService->expects($this->any())
->method('getFeaturesList')
->willThrowException(new ServiceException($exceptionMessage));
// Default status code when something breaks
$status = Http::STATUS_INTERNAL_SERVER_ERROR;
$errorMessage = [
'message' => $exceptionMessage . ' (' . $status . ')',
'success' => false
];
/** @type JSONResponse $response */
$response = $this->controller->get($slideshow);
$this->assertEquals($errorMessage, $response->getData());
} | CWE-79 | 1 |
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 __invoke(Request $request, Expense $expense)
{
$this->authorize('update', $expense);
$data = json_decode($request->attachment_receipt);
if ($data) {
if ($request->type === 'edit') {
$expense->clearMediaCollection('receipts');
}
$expense->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('receipts');
}
return response()->json([
'success' => 'Expense receipts uploaded successfully',
], 200);
} | CWE-79 | 1 |
static function isSearchable() {
return true;
}
| 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 |
function import() {
$pullable_modules = expModules::listInstalledControllers($this->baseclassname);
$modules = new expPaginator(array(
'records' => $pullable_modules,
'controller' => $this->loc->mod,
'action' => $this->params['action'],
'order' => isset($this->params['order']) ? $this->params['order'] : 'section',
'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',
'page' => (isset($this->params['page']) ? $this->params['page'] : 1),
'columns' => array(
gt('Title') => 'title',
gt('Page') => 'section'
),
));
assign_to_template(array(
'modules' => $modules,
));
}
| CWE-89 | 0 |
function insertObject($object, $table) {
//if ($table=="text") eDebug($object,true);
$sql = "INSERT INTO `" . $this->prefix . "$table` (";
$values = ") VALUES (";
foreach (get_object_vars($object) as $var => $val) {
//We do not want to save any fields that start with an '_'
if ($var{0} != '_') {
$sql .= "`$var`,";
if ($values != ") VALUES (") {
$values .= ",";
}
$values .= "'" . $this->escapeString($val) . "'";
}
}
$sql = substr($sql, 0, -1) . substr($values, 0) . ")";
//if($table=='text')eDebug($sql,true);
if (@mysqli_query($this->connection, $sql) != false) {
$id = mysqli_insert_id($this->connection);
return $id;
} else
return 0;
} | 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 |
public function manage() {
expHistory::set('manageable', $this->params);
// build out a SQL query that gets all the data we need and is sortable.
$sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';
$sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';
$sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type="banner")';
$page = new expPaginator(array(
'model'=>'banner',
'sql'=>$sql,
'order'=>'title',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title',
gt('Company')=>'companyname',
gt('Impressions')=>'impressions',
gt('Clicks')=>'clicks'
)
));
assign_to_template(array(
'page'=>$page
));
} | CWE-89 | 0 |
public function onInfoAction( $context, &$pageInfo ) {
$shortdesc = HookUtils::getShortDescription( $context->getTitle() );
if ( !$shortdesc ) {
// The page has no short description
return;
}
$pageInfo['header-basic'][] = [
$context->msg( 'shortdescription-info-label' ),
$shortdesc
];
} | CWE-79 | 1 |
$module_views[$key]['name'] = gt($value['name']);
}
// look for a config form for this module's current view
// $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod);
//check to see if hcview was passed along, indicating a hard-coded module
// if (!empty($controller->params['hcview'])) {
// $viewname = $controller->params['hcview'];
// } else {
// $viewname = $db->selectValue('container', 'view', "internal='".serialize($controller->loc)."'");
// }
// $viewconfig = $viewname.'.config';
// foreach ($modpaths as $path) {
// if (file_exists($path.'/'.$viewconfig)) {
// $fileparts = explode('_', $viewname);
// if ($fileparts[0]=='show'||$fileparts[0]=='showall') array_shift($fileparts);
// $module_views[$viewname]['name'] = ucwords(implode(' ', $fileparts)).' '.gt('View Configuration');
// $module_views[$viewname]['file'] =$path.'/'.$viewconfig;
// }
// }
// sort the views highest to lowest by filename
// we are reverse sorting now so our array merge
// will overwrite property..we will run array_reverse
// when we're finished to get them back in the right order
krsort($common_views);
krsort($module_views);
if (!empty($moduleconfig)) $common_views = array_merge($common_views, $moduleconfig);
$views = array_merge($common_views, $module_views);
$views = array_reverse($views);
return $views;
} | CWE-89 | 0 |
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId());
$this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']);
} | CWE-639 | 9 |
public function getMailingDetails($id)
{
trigger_error(sprintf('%s:%s is deprecated since Shopware 5.6 and will be private with 5.8.', __CLASS__, __METHOD__), E_USER_DEPRECATED);
$details = Shopware()->Modules()->Marketing()->sMailCampaignsGetDetail((int) $id);
foreach ($details['containers'] as $key => $container) {
if ($container['type'] === 'ctVoucher') {
if (!empty($container['value'])) {
$details['voucher'] = $container['value'];
}
$details['containers'][$key]['type'] = 'ctText';
}
if ($container['type'] === 'ctSuggest') {
$details['suggest'] = true;
}
}
return $details;
} | CWE-79 | 1 |
public function showall_tags() {
$images = $this->image->find('all');
$used_tags = array();
foreach ($images as $image) {
foreach($image->expTag as $tag) {
if (isset($used_tags[$tag->id])) {
$used_tags[$tag->id]->count++;
} else {
$exptag = new expTag($tag->id);
$used_tags[$tag->id] = $exptag;
$used_tags[$tag->id]->count = 1;
}
}
}
assign_to_template(array(
'tags'=>$used_tags
));
} | CWE-89 | 0 |
public function newpassword() {
if ($token = $this->param('token')) {
$user = $this->app->storage->findOne('cockpit/accounts', ['_reset_token' => $token]);
if (!$user) {
return false;
}
$user['md5email'] = md5($user['email']);
return $this->render('cockpit:views/layouts/newpassword.php', compact('user', 'token'));
}
return false;
} | CWE-89 | 0 |
function searchName() {
return gt("Calendar Event");
}
| CWE-89 | 0 |
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-22 | 2 |
public function testInvalidRequests($requestRange)
{
$response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag();
// prepare a request for a range of the testing file
$request = Request::create('/');
$request->headers->set('Range', $requestRange);
$response = clone $response;
$response->prepare($request);
$response->sendContent();
$this->assertEquals(416, $response->getStatusCode());
#$this->assertEquals('', $response->headers->get('Content-Range'));
} | 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 pathTestNoAuthority()
{
return [
// path-rootless
['urn:example:animal:ferret:nose'],
// path-absolute
['urn:/example:animal:ferret:nose'],
['urn:/'],
// path-empty
['urn:'],
['urn'],
];
} | 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 |
$variable[$key] = self::filter($val);
}
} else {
// Prevent XSS abuse
$variable = preg_replace_callback('#</?([a-z]+)(\s.*)?/?>#i', function($matches) {
$tag = strtolower($matches[1]);
// Allowed tags
if (in_array($tag, array(
'b', 'strong', 'small', 'i', 'em', 'u', 's', 'sub', 'sup', 'a', 'button', 'img', 'br',
'font', 'span', 'blockquote', 'q', 'abbr', 'address', 'code', 'hr',
'audio', 'video', 'source', 'iframe',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'ul', 'ol', 'li', 'dl', 'dt', 'dd',
'div', 'p', 'var',
'table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td', 'colgroup', 'col',
'section', 'article', 'aside'))) {
return $matches[0];
} else if (in_array($tag, array('script', 'link'))) {
return '';
} else {
return htmlentities($matches[0]);
}
}, $variable);
}
return $variable;
}
/**
* Retrieves the HTTP Method used by the client.
*
* @return string Either GET|POST|PUT|DEL...
*/
public static function getMethod() {
return $_SERVER['REQUEST_METHOD'];
}
/**
* Checks that the $url matches current route.
*
* @param string $url
* @param string $method (default = 'POST')
* @return bool
*/
public static function hasDataForURL($url, $method = 'POST') {
$route = WRoute::parseURL($url);
$current_route = WRoute::route();
return self::getMethod() == strtoupper($method)
&& $route['app'] == $current_route['app']
&& (!isset($current_route['params'][0]) || !isset($route['params'][0]) || $current_route['params'][0] == $route['params'][0]);
}
}
?>
| CWE-79 | 1 |
public function getHeaders()
{
return $this->headerLines;
} | CWE-89 | 0 |
public function getAmount()
{
$amount = $this->getParameter('amount');
if ($amount !== null) {
// Don't allow integers for currencies that support decimals.
// This is for legacy reasons - upgrades from v0.9
if ($this->getCurrencyDecimalPlaces() > 0) {
if (is_int($amount) || (is_string($amount) && false === strpos((string) $amount, '.'))) {
throw new InvalidRequestException(
'Please specify amount as a string or float, '
. 'with decimal places (e.g. \'10.00\' to represent $10.00).'
);
};
}
$amount = $this->toFloat($amount);
// Check for a negative amount.
if (!$this->negativeAmountAllowed && $amount < 0) {
throw new InvalidRequestException('A negative amount is not allowed.');
}
// Check for a zero amount.
if (!$this->zeroAmountAllowed && $amount === 0.0) {
throw new InvalidRequestException('A zero amount is not allowed.');
}
// Check for rounding that may occur if too many significant decimal digits are supplied.
$decimal_count = strlen(substr(strrchr((string)$amount, '.'), 1));
if ($decimal_count > $this->getCurrencyDecimalPlaces()) {
throw new InvalidRequestException('Amount precision is too high for currency.');
}
return $this->formatCurrency($amount);
}
} | CWE-89 | 0 |
public function update_version() {
// get the current version
$hv = new help_version();
$current_version = $hv->find('first', 'is_current=1');
// check to see if the we have a new current version and unset the old current version.
if (!empty($this->params['is_current'])) {
// $db->sql('UPDATE '.DB_TABLE_PREFIX.'_help_version set is_current=0');
help_version::clearHelpVersion();
}
expSession::un_set('help-version');
// save the version
$id = empty($this->params['id']) ? null : $this->params['id'];
$version = new help_version();
// if we don't have a current version yet so we will force this one to be it
if (empty($current_version->id)) $this->params['is_current'] = 1;
$version->update($this->params);
// if this is a new version we need to copy over docs
if (empty($id)) {
self::copydocs($current_version->id, $version->id);
}
// let's update the search index to reflect the current help version
searchController::spider();
flash('message', gt('Saved help version').' '.$version->version);
expHistory::back();
} | CWE-89 | 0 |
public static function exist($mod) {
$file = GX_MOD."/".$mod."/options.php";
if(file_exists($file)){
return true;
}else{
return false;
}
}
| CWE-89 | 0 |
public function isAllowedFilename($filename){
$allow_array = array(
'.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp',
'.mp3','.wav','.mp4',
'.mov','.webmv','.flac','.mkv',
'.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso',
'.pdf','.ofd','.swf','.epub','.xps',
'.doc','.docx','.wps',
'.ppt','.pptx','.xls','.xlsx','.txt','.psd','.csv',
'.cer','.ppt','.pub','.json','.css',
) ;
$ext = strtolower(substr($filename,strripos($filename,'.')) ); //获取文件扩展名(转为小写后)
if(in_array( $ext , $allow_array ) ){
return true ;
}
return false;
} | CWE-79 | 1 |
public function getBranches()
{
if (null === $this->branches) {
$branches = array();
$this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
foreach ($this->process->splitLines($output) as $branch) {
if ($branch && !Preg::isMatch('{^ *[^/]+/HEAD }', $branch)) {
if (Preg::isMatch('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
$branches[$match[1]] = $match[2];
}
}
}
$this->branches = $branches;
}
return $this->branches;
} | CWE-94 | 14 |
public function disable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public static function set($vars) {
self::set_session($vars);
}
| CWE-89 | 0 |
public static function is_exist($user) {
if(isset($_GET['act']) && $_GET['act'] == 'edit'){
$id = Typo::int($_GET['id']);
$where = "AND `id` != '{$id}' ";
}else{
$where = '';
}
$user = sprintf('%s', Typo::cleanX($user));
$sql = sprintf("SELECT `userid` FROM `user` WHERE `userid` = '%s' %s ", $user, $where);
$usr = Db::result($sql);
$n = Db::$num_rows;
if($n > 0 ){
return false;
}else{
return true;
}
}
| CWE-89 | 0 |
public function confirm()
{
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->response->html($this->helper->layout->project('custom_filter/remove', array(
'project' => $project,
'filter' => $filter,
'title' => t('Remove a custom filter')
)));
} | CWE-639 | 9 |
public function confirm()
{
$task = $this->getTask();
$link_id = $this->request->getIntegerParam('link_id');
$link = $this->taskExternalLinkModel->getById($link_id);
if (empty($link)) {
throw new PageNotFoundException();
}
$this->response->html($this->template->render('task_external_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | CWE-639 | 9 |
protected function moveVotes()
{
$sql = "SELECT * FROM package_proposal_votes WHERE pkg_prop_id = {$this->proposal}";
$res = $this->mdb2->query($sql);
if (MDB2::isError($res)) {
throw new RuntimeException("DB error occurred: {$res->getDebugInfo()}");
}
if ($res->numRows() == 0) {
return; // nothing to do
}
$insert = "INSERT INTO package_proposal_comments (";
$insert .= "user_handle, pkg_prop_id, timestamp, comment";
$insert .= ") VALUES(%s, {$this->proposal}, %d, %s)";
$delete = "DELETE FROM package_proposal_votes WHERE";
$delete .= " pkg_prop_id = {$this->proposal}";
$delete .= " AND user_handle = %s";
while ($row = $res->fetchRow(MDB2_FETCHMODE_OBJECT)) {
$comment = "Original vote: {$row->value}\n";
$comment .= "Conditional vote: " . ($row->is_conditional != 0)?'yes':'no' . "\n";
$comment .= "Comment on vote: " . $row->comment . "\n\n";
$comment .= "Reviewed: " . implode(", ", unserialize($row->reviews));
$sql = sprintf(
$insert,
$this->mdb2->quote($row->user_handle),
$row->timestamp,
$this->mdb2->quote($comment)
);
$this->queryChange($sql);
$sql = sprintf(
$delete,
$this->mdb2->quote($row->user_handle)
);
$this->queryChange($sql);
} | CWE-640 | 20 |
foreach($course_RET as $period_date)
{
// $period_days_append_sql .="(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND IF(course_period_date IS NULL, course_period_date='$period_date[COURSE_PERIOD_DATE]',DAYS LIKE '%$period_date[DAYS]%')) OR ";
$period_days_append_sql .="(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND (cpv.course_period_date IS NULL OR cpv.course_period_date='$period_date[COURSE_PERIOD_DATE]') AND cpv.DAYS LIKE '%$period_date[DAYS]%') OR ";
} | CWE-79 | 1 |
public function GetJsForUpdateFields()
{
$sWizardHelperJsVar = (!is_null($this->m_aData['m_sWizHelperJsVarName'])) ? utils::Sanitize($this->m_aData['m_sWizHelperJsVarName'], utils::ENUM_SANITIZATION_FILTER_PARAMETER) : 'oWizardHelper'.$this->GetFormPrefix();
//str_replace(['(', ')', ';'], '', $this->m_aData['m_sWizHelperJsVarName']) : 'oWizardHelper'.$this->GetFormPrefix();
$sWizardHelperJson = $this->ToJSON();
return <<<JS
{$sWizardHelperJsVar}.m_oData = {$sWizardHelperJson};
{$sWizardHelperJsVar}.UpdateFields();
JS;
} | CWE-79 | 1 |
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id);
if (!empty($newret)) $ret .= $newret . '<br>';
if ($iLoc->mod == 'container') {
$ret .= scan_container($container->internal, $page_id);
}
}
return $ret;
}
| CWE-89 | 0 |
public static function thmMenu(){
$thm = Options::v('themes');
//$mod = self::modList();
//print_r($mod);
$list = '';
# code...
$data = self::data($thm);
if(isset($_GET['page'])
&& $_GET['page'] == 'themes'
&& isset($_GET['view'])
&& $_GET['view'] == 'options'){
$class = 'class="active"';
}else{
$class = "";
}
if (self::optionsExist($thm)) {
$active = (isset($_GET['page'])
&& $_GET['page'] == 'themes'
&& isset($_GET['view'])
&& $_GET['view'] == 'options')?"class=\"active\"":"";
$list .= "
<li $class>
<a href=\"index.php?page=themes&view=options\" $active>".$data['icon']." ".$data['name']."</a>
</li>";
}else{
$list = '';
}
return $list;
}
| CWE-89 | 0 |
function update_upcharge() {
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
//This will make sure that only the country or region that given a rate value will be saved in the db
$upcharge = array();
foreach($this->params['upcharge'] as $key => $item) {
if(!empty($item)) {
$upcharge[$key] = $item;
}
}
$this->config['upcharge'] = $upcharge;
$config->update(array('config'=>$this->config));
flash('message', gt('Configuration updated'));
expHistory::back();
} | CWE-89 | 0 |
public function testNoAuthorityWithInvalidPath()
{
$input = 'urn://example:animal:ferret:nose';
$uri = new Uri($input);
} | CWE-89 | 0 |
public static function v($vars) {
$opt = self::$_data;
// echo "<pre>";
foreach ($opt as $k => $v) {
// echo $v->name;
if ($v->name == $vars) {
return $v->value;
}
}
// echo "</pre>";
}
| CWE-89 | 0 |
$module_views[$key]['name'] = gt($value['name']);
}
// look for a config form for this module's current view
// $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod);
//check to see if hcview was passed along, indicating a hard-coded module
// if (!empty($controller->params['hcview'])) {
// $viewname = $controller->params['hcview'];
// } else {
// $viewname = $db->selectValue('container', 'view', "internal='".serialize($controller->loc)."'");
// }
// $viewconfig = $viewname.'.config';
// foreach ($modpaths as $path) {
// if (file_exists($path.'/'.$viewconfig)) {
// $fileparts = explode('_', $viewname);
// if ($fileparts[0]=='show'||$fileparts[0]=='showall') array_shift($fileparts);
// $module_views[$viewname]['name'] = ucwords(implode(' ', $fileparts)).' '.gt('View Configuration');
// $module_views[$viewname]['file'] =$path.'/'.$viewconfig;
// }
// }
// sort the views highest to lowest by filename
// we are reverse sorting now so our array merge
// will overwrite property..we will run array_reverse
// when we're finished to get them back in the right order
krsort($common_views);
krsort($module_views);
if (!empty($moduleconfig)) $common_views = array_merge($common_views, $moduleconfig);
$views = array_merge($common_views, $module_views);
$views = array_reverse($views);
return $views;
} | CWE-89 | 0 |
public function __construct() {
self::$hooks = self::load();
}
| CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$comment = $this->getComment();
$this->response->html($this->template->render('comment/remove', array(
'comment' => $comment,
'task' => $task,
'title' => t('Remove a comment')
)));
} | CWE-639 | 9 |
public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) {
$opts = $this->opts;
$volOpts = $volume->getOptionsPlugin('Watermark');
if (is_array($volOpts)) {
$opts = array_merge($this->opts, $volOpts);
}
if (! $opts['enable']) {
return false;
}
$srcImgInfo = @getimagesize($src);
if ($srcImgInfo === false) {
return false;
}
// check Animation Gif
if (elFinder::isAnimationGif($src)) {
return false;
}
// check water mark image
if (! file_exists($opts['source'])) {
$opts['source'] = dirname(__FILE__) . "/" . $opts['source'];
}
if (is_readable($opts['source'])) {
$watermarkImgInfo = @getimagesize($opts['source']);
if (! $watermarkImgInfo) {
return false;
}
} else {
return false;
}
$watermark = $opts['source'];
$marginLeft = $opts['marginRight'];
$marginBottom = $opts['marginBottom'];
$quality = $opts['quality'];
$transparency = $opts['transparency'];
// check target image type
$imgTypes = array(
IMAGETYPE_GIF => IMG_GIF,
IMAGETYPE_JPEG => IMG_JPEG,
IMAGETYPE_PNG => IMG_PNG,
IMAGETYPE_BMP => IMG_WBMP,
IMAGETYPE_WBMP => IMG_WBMP
);
if (! ($opts['targetType'] & @$imgTypes[$srcImgInfo[2]])) {
return false;
}
// check target image size
if ($opts['targetMinPixel'] > 0 && $opts['targetMinPixel'] > min($srcImgInfo[0], $srcImgInfo[1])) {
return false;
}
$watermark_width = $watermarkImgInfo[0];
$watermark_height = $watermarkImgInfo[1];
$dest_x = $srcImgInfo[0] - $watermark_width - $marginLeft;
$dest_y = $srcImgInfo[1] - $watermark_height - $marginBottom;
if (class_exists('Imagick', false)) {
return $this->watermarkPrint_imagick($src, $watermark, $dest_x, $dest_y, $quality, $transparency, $watermarkImgInfo);
} else {
return $this->watermarkPrint_gd($src, $watermark, $dest_x, $dest_y, $quality, $transparency, $watermarkImgInfo, $srcImgInfo);
}
} | CWE-89 | 0 |
public function getQuerySelect()
{
} | CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$link = $this->getTaskLink();
$this->response->html($this->template->render('task_internal_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | CWE-639 | 9 |
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
| CWE-89 | 0 |
function insertObject($object, $table) {
//if ($table=="text") eDebug($object,true);
$sql = "INSERT INTO `" . $this->prefix . "$table` (";
$values = ") VALUES (";
foreach (get_object_vars($object) as $var => $val) {
//We do not want to save any fields that start with an '_'
if ($var{0} != '_') {
$sql .= "`$var`,";
if ($values != ") VALUES (") {
$values .= ",";
}
$values .= "'" . $this->escapeString($val) . "'";
}
}
$sql = substr($sql, 0, -1) . substr($values, 0) . ")";
//if($table=='text')eDebug($sql,true);
if (@mysqli_query($this->connection, $sql) != false) {
$id = mysqli_insert_id($this->connection);
return $id;
} else
return 0;
} | CWE-89 | 0 |
public function from($dirName)
{
$this->from = $dirName;
return $this;
} | CWE-22 | 2 |
protected function imagickImage($img, $filename, $destformat, $jpgQuality = null ){
if (!$jpgQuality) {
$jpgQuality = $this->options['jpgQuality'];
}
try {
if ($destformat) {
if ($destformat === 'gif') {
$img->setImageFormat('gif');
} else if ($destformat === 'png') {
$img->setImageFormat('png');
} else if ($destformat === 'jpg') {
$img->setImageFormat('jpeg');
}
}
if (strtoupper($img->getImageFormat()) === 'JPEG') {
$img->setImageCompression(imagick::COMPRESSION_JPEG);
$img->setImageCompressionQuality($jpgQuality);
try {
$orientation = $img->getImageOrientation();
} catch (ImagickException $e) {
$orientation = 0;
}
$img->stripImage();
if ($orientation) {
$img->setImageOrientation($orientation);
}
}
$result = $img->writeImage($filename);
} catch (Exception $e) {
$result = false;
}
return $result;
if ($destformat == 'jpg' || ($destformat == null && $mime == 'image/jpeg')) {
return imagejpeg($image, $filename, $jpgQuality);
}
if ($destformat == 'gif' || ($destformat == null && $mime == 'image/gif')) {
return imagegif($image, $filename, 7);
}
return imagepng($image, $filename, 7);
} | CWE-89 | 0 |
$emails[$u->email] = trim(user::getUserAttribution($u->id));
}
| CWE-89 | 0 |
function _makeChooseCheckbox($value, $title) {
// return '<INPUT type=checkbox name=st_arr[] value=' . $value . ' checked>';
global $THIS_RET;
return "<input name=unused[$THIS_RET[STUDENT_ID]] value=" . $THIS_RET[STUDENT_ID] . " type='checkbox' id=$THIS_RET[STUDENT_ID] onClick='setHiddenCheckboxStudents(\"st_arr[]\",this,$THIS_RET[STUDENT_ID]);' />";
} | CWE-89 | 0 |
protected function fixupImportedAttributes($modelName, X2Model &$model) {
if ($modelName === 'Contacts' || $modelName === 'X2Leads')
$this->fixupImportedContactName ($model);
if ($modelName === 'Actions' && isset($model->associationType))
$this->reconstructImportedActionAssoc($model);
if ($model->hasAttribute('visibility')) {
// Nobody every remembers to set visibility... set it for them
if(empty($model->visibility) && ($model->visibility !== 0 && $model->visibility !== "0")
|| $model->visibility == 'Public') {
$model->visibility = 1;
} elseif($model->visibility == 'Private')
$model->visibility = 0;
}
// If date fields were provided, do not create new values for them
if (!empty($model->createDate) || !empty($model->lastUpdated) ||
!empty($model->lastActivity)) {
$now = time();
if (empty($model->createDate))
$model->createDate = $now;
if (empty($model->lastUpdated))
$model->lastUpdated = $now;
if ($model->hasAttribute('lastActivity') && empty($model->lastActivity))
$model->lastActivity = $now;
}
if($_SESSION['leadRouting'] == 1){
$assignee = $this->getNextAssignee();
if($assignee == "Anyone")
$assignee = "";
$model->assignedTo = $assignee;
}
// Loop through our override and set the manual data
foreach($_SESSION['override'] as $attr => $val){
$model->$attr = $val;
}
} | CWE-79 | 1 |
public function approvedFileExtension($filename, $type = 'image')
{
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
if ($type == 'image') {
switch ($ext) {
case 'gif':
case 'png':
case 'jpeg':
case 'jpg':
case 'svg':
return true;
default:
return false;
}
} elseif ($type == 'cert') {
switch ($ext) {
case 'pem':
return true;
default:
return false;
}
}
} | CWE-79 | 1 |
public function confirm()
{
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
$this->response->html($this->template->render('project_tag/remove', array(
'tag' => $tag,
'project' => $project,
)));
} | CWE-639 | 9 |
$date->delete(); // event automatically deleted if all assoc eventdates are deleted
}
expHistory::back();
}
| 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 static function run() {
//print_r(self::$hooks[$var]);
$hooks = self::$hooks;
$num_args = func_num_args();
$args = func_get_args();
// print_r($args);
// if($num_args < 2)
// trigger_error("Insufficient arguments", E_USER_ERROR);
// Hook name should always be first argument
$hook_name = array_shift($args);
if(!isset($hooks[$hook_name]))
return; // No plugins have registered this hook
// print_r($args[0]);
// $args = (is_array($args))?$args[0]: $args;
if (is_array($hooks[$hook_name])) {
$val = '';
foreach($hooks[$hook_name] as $func){
if ($func != '') {
// $args = call_user_func_array($func, $args); //
$val .= $func((array)$args);
}else{
$val .= $args;
}
}
return $val;
}
}
| CWE-89 | 0 |
function singleQuoteReplace($param1 = false, $param2 = false, $param3)
{
return str_replace("'", "''", str_replace("\'", "'", $param3));
} | CWE-22 | 2 |
protected function _setContent($path, $fp) {
rewind($fp);
$fstat = fstat($fp);
$size = $fstat['size'];
} | CWE-89 | 0 |
public static function fixName($name) {
$name = preg_replace('/[^A-Za-z0-9\.]/','_',$name);
if ($name[0] == '.')
$name[0] = '_';
return $name;
// return preg_replace('/[^A-Za-z0-9\.]/', '-', $name);
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('SELECT * FROM nv_webusers WHERE website = '.protect($website->id), 'object');
if($type='json')
$out['nv_webusers'] = json_encode($DB->result());
$DB->query('SELECT nwp.* FROM nv_webuser_profiles nwp, nv_webusers nw
WHERE nwp.webuser = nw.id
AND nw.website = '.protect($website->id),
'object');
if($type='json')
$out['nv_webuser_profiles'] = json_encode($DB->result());
if($type='json')
$out = json_encode($out);
return $out;
}
| CWE-89 | 0 |
public function testCanCreateNewResponseWithStatusAndReason()
{
$r = new Response(200);
$r2 = $r->withStatus(201, 'Foo');
$this->assertEquals(200, $r->getStatusCode());
$this->assertEquals('OK', $r->getReasonPhrase());
$this->assertEquals(201, $r2->getStatusCode());
$this->assertEquals('Foo', $r2->getReasonPhrase());
} | CWE-89 | 0 |
public static function delete($id) {
$id = Typo::int($id);
try
{
$vars1 = array(
'table' => 'posts',
'where' => array(
'id' => $id
)
);
$d = Db::delete($vars1);
$vars2 = array(
'table' => 'posts_param',
'where' => array(
'post_id' => $id
)
);
$d = Db::delete($vars2);
Hooks::run('post_sqldel_action', $id);
return true;
}
catch (Exception $e)
{
return $e->getMessage();
}
}
| CWE-89 | 0 |
function insertCommandCategorieInDB(){
global $pearDB;
if (testCommandCategorieExistence($_POST["category_name"])){
$DBRESULT = $pearDB->query("INSERT INTO `command_categories` (`category_name` , `category_alias`, `category_order`) VALUES ('".$_POST["category_name"]."', '".$_POST["category_alias"]."', '1')");
}
} | CWE-94 | 14 |
function searchName() {
return gt("Calendar Event");
}
| CWE-89 | 0 |
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 |
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 function sdm_save_thumbnail_meta_data($post_id) { // Save Thumbnail Upload metabox
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
return;
if (!isset($_POST['sdm_thumbnail_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_thumbnail_box_nonce_check'], 'sdm_thumbnail_box_nonce'))
return;
if (isset($_POST['sdm_upload_thumbnail'])) {
update_post_meta($post_id, 'sdm_upload_thumbnail', $_POST['sdm_upload_thumbnail']);
}
} | CWE-79 | 1 |
$files[$key]->save();
}
// eDebug($files,true);
} | 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 |
static function validUTF($string) {
if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {
return false;
}
return true;
} | CWE-89 | 0 |
public function update_groupdiscounts() {
global $db;
if (empty($this->params['id'])) {
// look for existing discounts for the same group
$existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']);
if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.'));
}
$gd = new groupdiscounts();
$gd->update($this->params);
expHistory::back();
} | CWE-89 | 0 |
protected function _unlink($path) {
$ret = @unlink($path);
$ret && clearstatcache();
return $ret;
} | CWE-89 | 0 |
$_ret[$_k] = $this->convEnc($_v, $from, $to, '', false, $unknown = '_');
}
$var = $_ret;
} else {
$_var = false;
if (is_string($var)) {
$_var = $var;
if (false !== ($_var = @iconv($from, $to.'//TRANSLIT', $_var))) {
$_var = str_replace('?', $unknown, $_var);
}
}
if ($_var !== false) {
$var = $_var;
}
}
if ($restoreLocale) {
setlocale(LC_ALL, elFinder::$locale);
}
}
return $var;
} | CWE-89 | 0 |
function download_selected($dir)
{
$dir = get_abs_dir($dir);
global $site_name;
require_once("_include/fun_archive.php");
$items = qxpage_selected_items();
// check if user selected any items to download
switch (count($items))
{
case 0:
show_error($GLOBALS["error_msg"]["miscselitems"]);
case 1:
if (is_file($items[0]))
{
download_item( $dir, $items[0] );
break;
}
// nobreak, downloading a directory is done
// with the zip file
default:
zip_download( $dir, $items );
}
} | CWE-22 | 2 |
protected function getItemsInHand($hashes, $dir = null) {
static $totalSize = 0;
if (is_null($dir)) {
$totalSize = 0;
if (! $tmpDir = $this->getTempPath()) {
return false;
}
$dir = tempnam($tmpDir, 'elf');
if (!unlink($dir) || !mkdir($dir, 0700, true)) {
return false;
}
register_shutdown_function(array($this, 'rmdirRecursive'), $dir);
}
$res = true;
$files = array();
foreach ($hashes as $hash) {
if (($file = $this->file($hash)) == false) {
continue;
}
if (!$file['read']) {
continue;
}
$name = $file['name'];
// for call from search results
if (isset($files[$name])) {
$name = preg_replace('/^(.*?)(\..*)?$/', '$1_'.$files[$name]++.'$2', $name);
} else {
$files[$name] = 1;
}
$target = $dir.DIRECTORY_SEPARATOR.$name;
if ($file['mime'] === 'directory') {
$chashes = array();
$_files = $this->scandir($hash);
foreach($_files as $_file) {
if ($file['read']) {
$chashes[] = $_file['hash'];
}
}
if ($chashes) {
mkdir($target, 0700, true);
$res = $this->getItemsInHand($chashes, $target);
}
if (!$res) {
break;
}
!empty($file['ts']) && @touch($target, $file['ts']);
} else {
$path = $this->decode($hash);
if ($fp = $this->fopenCE($path)) {
if ($tfp = fopen($target, 'wb')) {
$totalSize += stream_copy_to_stream($fp, $tfp);
fclose($tfp);
}
!empty($file['ts']) && @touch($target, $file['ts']);
$this->fcloseCE($fp, $path);
}
if ($this->options['maxArcFilesSize'] > 0 && $this->options['maxArcFilesSize'] < $totalSize) {
$res = $this->setError(elFinder::ERROR_ARC_MAXSIZE);
}
}
}
return $res? $dir : false;
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$DB->query('SELECT * FROM nv_coupons WHERE website = '.protect($website->id), 'object');
$out = $DB->result();
if($type='json')
$out = json_encode($out);
return $out;
}
| CWE-89 | 0 |
public function __construct () {
}
| CWE-89 | 0 |
public function __construct(App $app)
{
$this->Config = $app->Config;
$this->Request = $app->Request;
$this->Session = $app->Session;
} | CWE-307 | 26 |
function columnUpdate($table, $col, $val, $where=1) {
$res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where");
/*if ($res == null)
return array();
$objects = array();
for ($i = 0; $i < mysqli_num_rows($res); $i++)
$objects[] = mysqli_fetch_object($res);*/
//return $objects;
} | CWE-89 | 0 |
public function query_single($column, $table, $where = '1=1', $order = '')
{
$rs = null;
if(!empty($order))
$order = ' ORDER BY '.$order;
try
{
$stm = $this->db->query('SELECT ' . $column . ' FROM ' . $table . ' WHERE ' . $where . $order . ' LIMIT 1');
$this->queries_count++;
$stm->setFetchMode(PDO::FETCH_NUM);
$rs = $stm->fetchAll();
$stm->closeCursor();
unset($stm);
}
catch(Exception $e)
{
return NULL;
}
if(empty($rs)) return NULL;
else return $rs[0][0];
}
| CWE-89 | 0 |
public function pathTestProvider()
{
return [
// Percent encode spaces.
['http://foo.com/baz bar', 'http://foo.com/baz%20bar'],
// Don't encoding something that's already encoded.
['http://foo.com/baz%20bar', 'http://foo.com/baz%20bar'],
// Percent encode invalid percent encodings
['http://foo.com/baz%2-bar', 'http://foo.com/baz%252-bar'],
// Don't encode path segments
['http://foo.com/baz/bar/bam?a', 'http://foo.com/baz/bar/bam?a'],
['http://foo.com/baz+bar', 'http://foo.com/baz+bar'],
['http://foo.com/baz:bar', 'http://foo.com/baz:bar'],
['http://foo.com/baz@bar', 'http://foo.com/baz@bar'],
['http://foo.com/baz(bar);bam/', 'http://foo.com/baz(bar);bam/'],
['http://foo.com/a-zA-Z0-9.-_~!$&\'()*+,;=:@', 'http://foo.com/a-zA-Z0-9.-_~!$&\'()*+,;=:@'],
];
} | CWE-89 | 0 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$category = $this->getCategory();
if ($this->categoryModel->remove($category['id'])) {
$this->flash->success(t('Category removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this category.'));
}
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
function prepareInputForUpdate($input) {
if (isset($input["passwd"])) {
if (empty($input["passwd"])) {
unset($input["passwd"]);
} else {
$input["passwd"] = Toolbox::encrypt(stripslashes($input["passwd"]), GLPIKEY);
}
}
if (isset($input["_blank_passwd"]) && $input["_blank_passwd"]) {
$input['passwd'] = '';
}
if (isset($input['mail_server']) && !empty($input['mail_server'])) {
$input["host"] = Toolbox::constructMailServerConfig($input);
}
if (isset($input['name']) && !NotificationMailing::isUserAddressValid($input['name'])) {
Session::addMessageAfterRedirect(__('Invalid email address'), false, ERROR);
}
return $input;
} | CWE-798 | 18 |
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 |
$output = sprintf( '<form action="%s" method="get">%s (%s): <input type="text" name="amount" value="%s"><br />%s<br /><textarea name="stripenote" cols="80" rows="2"></textarea><br /><input type="hidden" name="txid" value="%s"><button class="stripebutton">%s</button>%s</form>', $url, __( 'Amount', 'rsvpmaker' ), esc_attr( strtoupper( $vars['currency'] ) ), esc_attr( $vars['amount'] ), __('Note','rsvpmaker'), esc_attr( $idempotency_key ), __( 'Pay with Card' ), rsvpmaker_nonce('return') ); | CWE-89 | 0 |
$period_days_append_sql= substr($period_days_append_sql,0,-4).'))';
}
$exist_RET= DBGet(DBQuery("SELECT s.ID FROM schedule s WHERE student_id=". $student_id." AND s.syear='".UserSyear()."' {$mp_append_sql}{$period_days_append_sql} UNION SELECT s.ID FROM temp_schedule s WHERE student_id=". $student_id."{$mp_append_sql}{$period_days_append_sql}"));
if($exist_RET)
return 'There is a Period Conflict ('.$course_RET[1]['CP_TITLE'].')';
else
{
return true;
}
} | CWE-79 | 1 |
$content = ($vars['excerpt'])? substr(
strip_tags(
Typo::Xclean($p->content)
), 0, $excerptMax): "";
echo "<li class=\"".$liClass."\">
<h4 class=\"".$h4Class."\"><a href=\"".Url::post($p->id)."\">{$p->title}</a></h4>
<p class=\"".$pClass."\">".$content."</p>
</li>";
}
| CWE-89 | 0 |
public final function setAction($strAction) {
$this->strAction = $strAction;
} | CWE-79 | 1 |
$module_views[$key]['name'] = gt($value['name']);
}
// look for a config form for this module's current view
// $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod);
//check to see if hcview was passed along, indicating a hard-coded module
// if (!empty($controller->params['hcview'])) {
// $viewname = $controller->params['hcview'];
// } else {
// $viewname = $db->selectValue('container', 'view', "internal='".serialize($controller->loc)."'");
// }
// $viewconfig = $viewname.'.config';
// foreach ($modpaths as $path) {
// if (file_exists($path.'/'.$viewconfig)) {
// $fileparts = explode('_', $viewname);
// if ($fileparts[0]=='show'||$fileparts[0]=='showall') array_shift($fileparts);
// $module_views[$viewname]['name'] = ucwords(implode(' ', $fileparts)).' '.gt('View Configuration');
// $module_views[$viewname]['file'] =$path.'/'.$viewconfig;
// }
// }
// sort the views highest to lowest by filename
// we are reverse sorting now so our array merge
// will overwrite property..we will run array_reverse
// when we're finished to get them back in the right order
krsort($common_views);
krsort($module_views);
if (!empty($moduleconfig)) $common_views = array_merge($common_views, $moduleconfig);
$views = array_merge($common_views, $module_views);
$views = array_reverse($views);
return $views;
} | CWE-89 | 0 |
protected function gdImageCreate($path,$mime){
switch($mime){
case 'image/jpeg':
return @imagecreatefromjpeg($path);
case 'image/png':
return @imagecreatefrompng($path);
case 'image/gif':
return @imagecreatefromgif($path);
case 'image/x-ms-bmp':
if (!function_exists('imagecreatefrombmp')) {
include_once dirname(__FILE__).'/libs/GdBmp.php';
}
return @imagecreatefrombmp($path);
case 'image/xbm':
return @imagecreatefromxbm($path);
case 'image/xpm':
return @imagecreatefromxpm($path);
}
return false;
} | CWE-89 | 0 |
public function __construct()
{
$this->options['alias'] = ''; // alias to replace root dir name
$this->options['dirMode'] = 0755; // new dirs mode
$this->options['fileMode'] = 0644; // new files mode
$this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden)
$this->options['rootCssClass'] = 'elfinder-navbar-root-local';
$this->options['followSymLinks'] = true;
$this->options['detectDirIcon'] = ''; // file name that is detected as a folder icon e.g. '.diricon.png'
$this->options['keepTimestamp'] = array('copy', 'move'); // keep timestamp at inner filesystem allowed 'copy', 'move' and 'upload'
$this->options['substituteImg'] = true; // support substitute image with dim command
$this->options['statCorrector'] = null; // callable to correct stat data `function(&$stat, $path, $statOwner, $volumeDriveInstance){}`
} | CWE-22 | 2 |
public static function desc($vars){
if(!empty($vars)){
$desc = substr(strip_tags(htmlspecialchars_decode($vars).". ".Options::get('sitedesc')),0,150);
}else{
$desc = substr(Options::get('sitedesc'),0,150);
}
return $desc;
} | CWE-89 | 0 |
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 |
public function setGroupBy($groupBy, $qoute = true)
{
$this->setData(null);
if ($groupBy) {
$this->groupBy = $groupBy;
if ($qoute && strpos($groupBy, '`') !== 0) {
$this->groupBy = '`' . $this->groupBy . '`';
}
}
return $this;
} | CWE-89 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.