code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && false ?: '_'}); | CWE-89 | 0 |
function scan_page($parent_id) {
global $db;
$sections = $db->selectObjects('section','parent=' . $parent_id);
$ret = '';
foreach ($sections as $page) {
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));
$ret .= scan_container($cLoc, $page->id);
$ret .= scan_page($page->id);
}
return $ret;
}
| CWE-89 | 0 |
public function testQueryMustBeValid()
{
(new Uri(''))->withQuery(new \stdClass);
} | CWE-89 | 0 |
public function testPages () {
$this->visitPages ( $this->allPages );
} | CWE-79 | 1 |
public function take($value)
{
return $this->limit($value);
} | CWE-79 | 1 |
public function setLinks($links)
{
$return = $this->setOneToMany($links, Link::class, 'links', 'container');
$this->setType('ctLinks');
return $return;
} | CWE-79 | 1 |
$this->_writeBackup($tmpDir . 'plugin' . DS, $plugin['Plugin']['name'], $encoding);
}
}
// ZIP圧縮して出力
$fileName = 'baserbackup_' . $version . '_' . date('Ymd_His');
$Simplezip = new Simplezip();
$Simplezip->addFolder($tmpDir);
$Simplezip->download($fileName);
$this->_resetTmpSchemaFolder();
exit();
} | CWE-78 | 6 |
self::rpc($p);
//echo "'$p'<br>";
}
}
}
| CWE-89 | 0 |
foreach($fields as $field)
{
if(substr($key, 0, strlen($field.'-'))==$field.'-')
$this->dictionary[substr($key, strlen($field.'-'))][$field] = $value;
}
| CWE-79 | 1 |
protected function _copy($source, $targetDir, $name)
{
$res = false;
$target = $this->_joinPath($targetDir, $name);
if ($this->tmp) {
$local = $this->getTempFile();
if ($this->connect->get($source, $local)
&& $this->connect->put($target, $local, NET_SFTP_LOCAL_FILE)) {
$res = true;
}
unlink($local);
} else {
//not memory efficient
$res = $this->_filePutContents($target, $this->_getContents($source));
}
return $res;
} | CWE-22 | 2 |
public function actionGetItems(){
$sql =
'SELECT id, name as value
FROM x2_templates
WHERE name
LIKE :qterm
ORDER BY name ASC';
$command = Yii::app()->db->createCommand($sql);
$qterm = $_GET['term'].'%';
$command->bindParam(":qterm", $qterm, PDO::PARAM_STR);
$result = $command->queryAll();
echo CJSON::encode($result); exit;
} | CWE-79 | 1 |
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 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 |
$loc = expCore::makeLocation('navigation', '', $standalone->id);
if (expPermissions::check('manage', $loc)) return true;
}
return false;
}
| CWE-89 | 0 |
public function withPort($port)
{
$port = $this->filterPort($this->scheme, $this->host, $port);
if ($this->port === $port) {
return $this;
}
$new = clone $this;
$new->port = $port;
return $new;
} | CWE-89 | 0 |
public function __invoke(Request $request)
{
$this->authorize('manage modules');
$response = ModuleInstaller::upload($request);
return response()->json($response);
} | CWE-502 | 15 |
public function lists($column, $key = null)
{
$select = is_null($key) ? [$column] : [$column, $key];
if (!is_null($this->cacheMinutes)) {
$results = $this->getCached($select);
}
else {
$results = $this->getFresh($select);
}
$collection = new Collection($results);
return $collection->lists($column, $key);
} | CWE-79 | 1 |
public function approve_toggle() {
if (empty($this->params['id'])) return;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
$comment = new expComment($this->params['id']);
$comment->approved = $comment->approved == 1 ? 0 : 1;
if ($comment->approved) {
$this->sendApprovalNotification($comment,$this->params);
}
$comment->save();
expHistory::back();
} | CWE-89 | 0 |
function ac_sigleme($str, $name, $id) {
global $cms_db, $sess;
$sess->gc( true );
if( $id >= 1 && $this->session_enabled ) {
$this->db->query(sprintf("delete from %s where name = '%s' and sid != '%s' and user_id = '%s'",
$cms_db[sessions],
addslashes($name),
$str,
$id));
}
} | CWE-89 | 0 |
function remove() {
global $db;
$section = $db->selectObject('section', 'id=' . $this->params['id']);
if ($section) {
section::removeLevel($section->id);
$db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent);
$section->parent = -1;
$db->updateObject($section, 'section');
expSession::clearAllUsersSessionCache('navigation');
expHistory::back();
} else {
notfoundController::handle_not_authorized();
}
}
| CWE-89 | 0 |
private function sendString ($string) {
$bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
return $bytes_sent;
} | CWE-79 | 1 |
public function enable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->enable($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 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 insert($vars) {
if(is_array($vars)) {
$slug = Typo::slugify($vars['title']);
$vars = array_merge($vars, array('slug' => $slug));
//print_r($vars);
$ins = array(
'table' => 'options',
'key' => $vars
);
$post = Db::insert($ins);
}
return $post;
} | CWE-79 | 1 |
public function setContainer($container)
{
$this->container = $container;
$container->setType('ctLinks');
} | CWE-79 | 1 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-22 | 2 |
public static function ModMenu(){
$json = Options::v('modules');
$mod = json_decode($json, true);
//$mod = self::modList();
//print_r($mod);
if(is_array($mod)){
$list = '';
asort($mod);
foreach ($mod as $m) {
# code...
if(self::exist($m)){
$data = self::data($m);
if(isset($_GET['mod']) && $_GET['mod'] == $m){
$class = 'class="active"';
}else{
$class = "";
}
$list .= "<li $class><a href=\"index.php?page=mods&mod={$m}\" >".$data['icon']." ".$data['name']."</a></li>";
}
}
}else{
$list = "";
}
return $list;
}
| CWE-89 | 0 |
function manage() {
expHistory::set('viewable', $this->params);
// $category = new storeCategory();
// $categories = $category->getFullTree();
//
// // foreach($categories as $i=>$val){
// // if (!empty($this->values) && in_array($val->id,$this->values)) {
// // $this->tags[$i]->value = true;
// // } else {
// // $this->tags[$i]->value = false;
// // }
// // $this->tags[$i]->draggable = $this->draggable;
// // $this->tags[$i]->checkable = $this->checkable;
// // }
//
// $obj = json_encode($categories);
} | CWE-89 | 0 |
} elseif (!empty($this->params['src'])) {
if ($this->params['src'] == $loc->src) {
$this->config = $config->config;
break;
}
}
}
| CWE-89 | 0 |
public static function content($vars) {
$post = Typo::Xclean($vars);
preg_match_all("[[\-\-readmore\-\-]]", $post, $more);
if (is_array($more[0])) {
$post = str_replace('[[--readmore--]]', '', $post);
// return $post;
}else{
$post = $post;
}
$post = Hooks::filter('post_content_filter', $post);
return $post;
}
| CWE-89 | 0 |
return new Response($emailLog->getHtmlLog());
} elseif ($request->get('type') == 'params') { | CWE-79 | 1 |
public function enable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->enable($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 |
function selectBillingOptions() {
} | CWE-89 | 0 |
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
| CWE-89 | 0 |
protected function _mkdir($path, $name) {
$path = $this->_joinPath($path, $name);
if (@mkdir($path)) {
@chmod($path, $this->options['dirMode']);
clearstatcache();
return $path;
}
return false;
} | CWE-89 | 0 |
static function author() {
return "Dave Leffler";
}
| CWE-89 | 0 |
$files[$key]->save();
}
// eDebug($files,true);
} | CWE-89 | 0 |
public function getLatestRevisions()
{
if (! $this->latest_revisions) {
$pm = ProjectManager::instance();
$project = $pm->getProject($this->group_id);
if ($project && $this->canBeUsedByProject($project)) {
list($this->latest_revisions,) = svn_get_revisions($project, 0, 5, '', '', '', '', 0, false);
}
}
return $this->latest_revisions;
} | CWE-89 | 0 |
public static function create(
RequestInterface $request,
ResponseInterface $response = null,
\Exception $previous = null,
array $ctx = []
) {
if (!$response) {
return new self(
'Error completing request',
$request,
null,
$previous,
$ctx
);
}
$level = floor($response->getStatusCode() / 100);
if ($level == '4') {
$label = 'Client error';
$className = __NAMESPACE__ . '\\ClientException';
} elseif ($level == '5') {
$label = 'Server error';
$className = __NAMESPACE__ . '\\ServerException';
} else {
$label = 'Unsuccessful request';
$className = __CLASS__;
}
// Server Error: `GET /` resulted in a `404 Not Found` response:
// <html> ... (truncated)
$message = sprintf(
'%s: `%s` resulted in a `%s` response',
$label,
$request->getMethod() . ' ' . $request->getUri(),
$response->getStatusCode() . ' ' . $response->getReasonPhrase()
);
$summary = static::getResponseBodySummary($response);
if ($summary !== null) {
$message .= ":\n{$summary}\n";
}
return new $className($message, $request, $response, $previous, $ctx);
} | CWE-89 | 0 |
firstname: l.attr('data-firstname')
});
l.append(`
<div class="member-details">
${member_item}
${l.attr('data-name') || `${member_itemtype} (${member_items_id})`}
</div>
<button type="button" name="delete" class="btn btn-ghost-danger">
<i class="ti ti-x" title="${__('Delete')}"></i>
</button>
`);
}); | CWE-79 | 1 |
$banner->increaseImpressions();
}
}
// assign banner to the template and show it!
assign_to_template(array(
'banners'=>$banners
));
} | CWE-89 | 0 |
public function scopeSearch(Builder $query, array $search = [])
{
if (empty($search)) {
return $query;
}
if (!array_intersect(array_keys($search), $this->searchable)) {
return $query;
}
return $query->where($search);
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('
SELECT * FROM nv_paths
WHERE website = '.protect($website->id),
'object'
);
$out = $DB->result();
if($type='json')
$out = json_encode($out);
return $out;
}
| CWE-89 | 0 |
public function render($ignoreCli = false)
{
if (!$ignoreCli && php_sapi_name() == 'cli') {
$this->log();
file_put_contents('php://stderr', $this->getException()->__toString()."\n");
exit(1);
}
$view = Kwf_Debug::getView();
$view->exception = $this->getException();
$view->message = $this->getException()->getMessage();
$view->requestUri = isset($_SERVER['REQUEST_URI']) ?
$_SERVER['REQUEST_URI'] : '' ;
$view->debug = Kwf_Exception::isDebug();
$header = $this->getHeader();
$template = $this->getTemplate();
$template = strtolower(Zend_Filter::filterStatic($template, 'Word_CamelCaseToDash').'.tpl');
$this->log();
if (!headers_sent()) {
header($header);
header('Content-Type: text/html; charset=utf-8');
}
try {
echo $view->render($template);
} catch (Exception $e) {
echo '<pre>';
echo $this->__toString();
echo "\n\n\nError happened while handling exception:";
echo $e->__toString();
echo '</pre>';
}
Kwf_Benchmark::shutDown();
Kwf_Benchmark::output();
} | CWE-79 | 1 |
list($workgroup, $user) = explode('\\', $user);
} else {
$workgroup = null;
}
$this->state->init($workgroup, $user, $this->server->getPassword());
} | CWE-78 | 6 |
public function enable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->enable($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 |
$product = X2Model::model('Products')->findByAttributes(array('name'=>$lineItem->name));
if (isset($product))
$lineItem->productId = $product->id;
if(empty($lineItem->currency))
$lineItem->currency = $defaultCurrency;
if($lineItem->isPercentAdjustment) {
$lineItem->adjustment = Fields::strToNumeric(
$lineItem->adjustment,'percentage');
} else {
$lineItem->adjustment = Fields::strToNumeric(
$lineItem->adjustment,'currency',$curSym);
}
$lineItem->price = Fields::strToNumeric($lineItem->price,'currency',$curSym);
$lineItem->total = Fields::strToNumeric($lineItem->total,'currency',$curSym);
} | 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 remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->checkPermission($project, $filter);
if ($this->customFilterModel->remove($filter['id'])) {
$this->flash->success(t('Custom filter removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this custom filter.'));
}
$this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_converter/show', array(
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
static function FromJSON($sJson)
{
if (is_array($sJson))
{
$aJson = $sJson;
}
else
{
$aJson = json_decode($sJson, true);
}
/** @var \Combodo\iTop\Portal\Form\ObjectFormManager $oFormManager */
$oFormManager = parent::FromJSON($sJson);
// Retrieving object to edit
if (!isset($aJson['formobject_class']))
{
throw new Exception('Object class must be defined in order to generate the form');
}
$sObjectClass = $aJson['formobject_class'];
if (!isset($aJson['formobject_id']))
{
$oObject = MetaModel::NewObject($sObjectClass);
}
else
{
// Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated
$oObject = MetaModel::GetObject($sObjectClass, $aJson['formobject_id'], true, true);
}
$oFormManager->SetObject($oObject);
// Retrieving form mode
if (!isset($aJson['formmode']))
{
throw new Exception('Form mode must be defined in order to generate the form');
}
$oFormManager->SetMode($aJson['formmode']);
// Retrieving actions rules
if (isset($aJson['formactionrulestoken']))
{
$oFormManager->SetActionRulesToken($aJson['formactionrulestoken']);
}
// Retrieving form properties
if (isset($aJson['formproperties']))
{
// As empty array are no passed through HTTP, this one is not always present and we have to ensure it is.
if (!isset($aJson['formproperties']['fields']))
{
$aJson['formproperties']['fields'] = array();
}
$oFormManager->SetFormProperties($aJson['formproperties']);
}
// Retrieving callback urls
if (!isset($aJson['formcallbacks']))
{
// TODO
}
return $oFormManager;
} | CWE-94 | 14 |
form_selectable_cell(filter_value($vdef['name'], get_request_var('filter'), 'vdef.php?action=edit&id=' . $vdef['id']), $vdef['id']);
form_selectable_cell($disabled ? __('No'):__('Yes'), $vdef['id'], '', 'text-align:right');
form_selectable_cell(number_format_i18n($vdef['graphs'], '-1'), $vdef['id'], '', 'text-align:right');
form_selectable_cell(number_format_i18n($vdef['templates'], '-1'), $vdef['id'], '', 'text-align:right');
form_checkbox_cell($vdef['name'], $vdef['id'], $disabled);
form_end_row();
} | CWE-79 | 1 |
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 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 static function val ($vars) {
$val = $_SESSION['gxsess']['val'];
foreach ($val as $k => $v) {
# code...
switch ($k) {
case $vars:
return $v;
break;
default:
//echo "no value";
break;
}
}
}
| 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 |
function unlockTables() {
$sql = "UNLOCK TABLES";
$res = mysqli_query($this->connection, $sql);
return $res;
} | CWE-89 | 0 |
static protected function getFontsizeSelection()
{
$current_size = $GLOBALS['PMA_Config']->get('fontsize');
// for the case when there is no config file (this is supported)
if (empty($current_size)) {
if (isset($_COOKIE['pma_fontsize'])) {
$current_size = $_COOKIE['pma_fontsize'];
} else {
$current_size = '82%';
}
}
$options = PMA_Config::getFontsizeOptions($current_size);
$return = '<label for="select_fontsize">' . __('Font size')
. ':</label>' . "\n"
. '<select name="set_fontsize" id="select_fontsize"'
. ' class="autosubmit">' . "\n";
foreach ($options as $option) {
$return .= '<option value="' . $option . '"';
if ($option == $current_size) {
$return .= ' selected="selected"';
}
$return .= '>' . $option . '</option>' . "\n";
}
$return .= '</select>';
return $return;
} | CWE-79 | 1 |
public function getPrintAndMailLink($icmsObj) {
global $icmsConfig, $impresscms;
$ret = '';
/* $printlink = $this->handler->_moduleUrl . "print.php?" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName);
$js = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);";
$printlink = '<a href="' . $js . '"><img src="' . ICMS_IMAGES_SET_URL . '/actions/fileprint.png" alt="" style="vertical-align: middle;"/></a>';
$icmsModule = icms_getModuleInfo($icmsObj->handler->_moduleName);
$link = $impresscms->urls['full']();
$mid = $icmsModule->getVar('mid');
$friendlink = "<a href=\"javascript:openWithSelfMain('".SMARTOBJECT_URL."sendlink.php?link=" . $link . "&mid=" . $mid . "', ',',',',',','sendmessage', 674, 500);\"><img src=\"".SMARTOBJECT_IMAGES_ACTIONS_URL . "mail_send.png\" alt=\"" . _CO_ICMS_EMAIL . "\" title=\"" . _CO_ICMS_EMAIL . "\" style=\"vertical-align: middle;\"/></a>";
$ret = '<span id="smartobject_print_button">' . $printlink . " </span>" . '<span id="smartobject_mail_button">' . $friendlink . '</span>';
*/
return $ret;
}
| CWE-22 | 2 |
function configure() {
expHistory::set('editable', $this->params);
// little bit of trickery so that that categories can have their own configs
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
$pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);
$views = expTemplate::get_config_templates($this, $this->loc);
$gc = new geoCountry();
$countries = $gc->find('all');
$gr = new geoRegion();
$regions = $gr->find('all');
assign_to_template(array(
'config'=>$this->config,
'pullable_modules'=>$pullable_modules,
'views'=>$views,
'countries'=>$countries,
'regions'=>$regions,
'title'=>static::displayname()
));
} | CWE-89 | 0 |
$iloc = expUnserialize($container->internal);
if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) {
// There is no sectionref for this container. Populate sectionref
if ($container->external != "N;") {
$newSecRef = new stdClass();
$newSecRef->module = $iloc->mod;
$newSecRef->source = $iloc->src;
$newSecRef->internal = '';
$newSecRef->refcount = 1;
// $newSecRef->is_original = 1;
$eloc = expUnserialize($container->external);
// $section = $db->selectObject('sectionref',"module='containermodule' AND source='".$eloc->src."'");
$section = $db->selectObject('sectionref',"module='container' AND source='".$eloc->src."'");
if (!empty($section)) {
$newSecRef->section = $section->id;
$db->insertObject($newSecRef,"sectionref");
$missing_sectionrefs[] = gt("Missing sectionref for container replaced").": ".$iloc->mod." - ".$iloc->src." - PageID #".$section->id;
} else {
$db->delete('container','id="'.$container->id.'"');
$missing_sectionrefs[] = gt("Cant' find the container page for container").": ".$iloc->mod." - ".$iloc->src.' - '.gt('deleted');
}
}
}
}
assign_to_template(array(
'missing_sectionrefs'=>$missing_sectionrefs,
));
} | CWE-89 | 0 |
public function umount() {
$this->connect && @ftp_close($this->connect);
} | CWE-89 | 0 |
public static function Xclean($vars) {
$var = htmlspecialchars_decode($vars);
// $var = html_entity_decode($vars);
return $var;
} | CWE-89 | 0 |
function get_the_generator( $type = '' ) {
if ( empty( $type ) ) {
$current_filter = current_filter();
if ( empty( $current_filter ) ) {
return;
}
switch ( $current_filter ) {
case 'rss2_head':
case 'commentsrss2_head':
$type = 'rss2';
break;
case 'rss_head':
case 'opml_head':
$type = 'comment';
break;
case 'rdf_header':
$type = 'rdf';
break;
case 'atom_head':
case 'comments_atom_head':
case 'app_head':
$type = 'atom';
break;
}
}
switch ( $type ) {
case 'html':
$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';
break;
case 'xhtml':
$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />';
break;
case 'atom':
$gen = '<generator uri="https://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
break;
case 'rss2':
$gen = '<generator>https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';
break;
case 'rdf':
$gen = '<admin:generatorAgent rdf:resource="https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';
break;
case 'comment':
$gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
break;
case 'export':
$gen = '<!-- generator="WordPress/' . get_bloginfo_rss( 'version' ) . '" created="' . date( 'Y-m-d H:i' ) . '" -->';
break;
}
/**
* Filters the HTML for the retrieved generator type.
*
* The dynamic portion of the hook name, `$type`, refers to the generator type.
*
* @since 2.5.0
*
* @param string $gen The HTML markup output to wp_head().
* @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom',
* 'rss2', 'rdf', 'comment', 'export'.
*/
return apply_filters( "get_the_generator_{$type}", $gen, $type );
} | CWE-79 | 1 |
public function get($extramediatypes = false) {
try {
return $this->getConfig($extramediatypes);
} catch (\Exception $exception) {
return $this->jsonError($exception);
}
} | CWE-79 | 1 |
public function beforeSave () {
$valid = parent::beforeSave ();
if ($valid) {
$table = Yii::app()->db->schema->tables[$this->myTableName];
$existing = array_key_exists($this->fieldName, $table->columns) &&
$table->columns[$this->fieldName] instanceof CDbColumnSchema;
if($existing){
$valid = $this->modifyColumn();
}
}
return $valid;
} | CWE-79 | 1 |
public static function CanTrustFormLayoutContent($sPostedFormManagerData, $aOriginalFormProperties)
{
$aPostedFormManagerData = json_decode($sPostedFormManagerData, true);
$sPostedFormLayoutType = (isset($aPostedFormManagerData['formproperties']['layout']['type'])) ? $aPostedFormManagerData['formproperties']['layout']['type'] : '';
if ($sPostedFormLayoutType === 'xhtml') {
return true;
}
// we need to parse the content so that autoclose tags are returned correctly (`<div />` => `<div></div>`)
$oHtmlDocument = new \DOMDocument();
$sPostedFormLayoutContent = (isset($aPostedFormManagerData['formproperties']['layout']['content'])) ? $aPostedFormManagerData['formproperties']['layout']['content'] : '';
$oHtmlDocument->loadXML('<root>'.$sPostedFormLayoutContent.'</root>');
$sPostedFormLayoutRendered = $oHtmlDocument->saveHTML();
$sOriginalFormLayoutContent = (isset($aOriginalFormProperties['layout']['content'])) ? $aOriginalFormProperties['layout']['content'] : '';
$oHtmlDocument->loadXML('<root>'.$sOriginalFormLayoutContent.'</root>');
$sOriginalFormLayoutContentRendered = $oHtmlDocument->saveHTML();
return ($sPostedFormLayoutRendered === $sOriginalFormLayoutContentRendered);
} | CWE-94 | 14 |
public function createDatabase($dbname = null)
{
Database::query("CREATE DATABASE `" . $dbname . "`");
} | CWE-89 | 0 |
function reset_stats() {
// global $db;
// reset the counters
// $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1');
banner::resetImpressions();
// $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1');
banner::resetClicks();
// let the user know we did stuff.
flash('message', gt("Banner statistics reset."));
expHistory::back();
} | CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$link = $this->getTaskLink();
$this->response->html($this->template->render('task_internal_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | CWE-639 | 9 |
public function getFileContent($file, $identifier)
{
$resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
$this->process->execute($resource, $content, $this->repoDir);
if (!trim($content)) {
return null;
}
return $content;
} | CWE-94 | 14 |
public function delete($id)
{
if ($this->securityController->isWikiHibernated()) {
throw new \Exception(_t('WIKI_IN_HIBERNATION'));
}
// tests of if $formId is int
if (strval(intval($id)) != strval($id)) {
return null ;
}
$this->clear($id);
return $this->dbService->query('DELETE FROM ' . $this->dbService->prefixTable('nature') . 'WHERE bn_id_nature=' . $id);
} | CWE-89 | 0 |
public function Disconnect () {
$this->sendString('QUIT');
fclose($this->pop_conn);
} | CWE-79 | 1 |
public static function incFunc($var) {
if (self::functionExist($var)) {
include(GX_THEME.$var.'/function.php');
}
}
| CWE-89 | 0 |
public function withScheme($scheme)
{
$scheme = $this->filterScheme($scheme);
if ($this->scheme === $scheme) {
return $this;
}
$new = clone $this;
$new->scheme = $scheme;
$new->port = $new->filterPort($new->scheme, $new->host, $new->port);
return $new;
} | CWE-89 | 0 |
foreach ($criteria as $criterion) {
// recursive call
if (isset($criterion['criteria'])) {
return $check_criteria($criterion['criteria']);
}
if (!isset($criterion['field']) || !isset($criterion['searchtype'])
|| !isset($criterion['value'])) {
return __("Malformed search criteria");
}
if (!ctype_digit((string) $criterion['field'])
|| !array_key_exists($criterion['field'], $soptions)) {
return __("Bad field ID in search criteria");
}
if (isset($soptions[$criterion['field']])
&& isset($soptions[$criterion['field']]['nosearch'])
&& $soptions[$criterion['field']]['nosearch']) {
return __("Forbidden field ID in search criteria");
}
} | CWE-89 | 0 |
$user = db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($check['user']), 'username');
form_alternate_row('line' . $check['id']);
$name = get_data_source_title($check['datasource']);
$title = $name;
if (strlen($name) > 50) {
$name = substr($name, 0, 50);
}
form_selectable_cell('<a class="linkEditMain" title="' . $title .'" href="' . htmlspecialchars('data_debug.php?action=view&id=' . $check['id']) . '">' . $name . '</a>', $check['id']);
form_selectable_cell($user, $check['id']);
form_selectable_cell(date('F j, Y, G:i', $check['started']), $check['id']);
form_selectable_cell($check['datasource'], $check['id']);
form_selectable_cell(debug_icon(($check['done'] ? (strlen($issue_line) ? 'off' : 'on' ) : '')), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['rrd_writable']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['rrd_exists']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['active']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['rrd_match']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['valid_data']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon(($info['rra_timestamp2'] != '' ? 1 : '')), $check['id'], '', 'text-align: center;');
form_selectable_cell('<a class=\'linkEditMain\' href=\'#\' title="' . html_escape($issue_title) . '">' . html_escape(strlen(trim($issue_line)) ? $issue_line : '<none>') . '</a>', $check['id']);
form_checkbox_cell($check['id'], $check['id']);
form_end_row();
}
}else{ | CWE-79 | 1 |
$section = new section(intval($page));
if ($section) {
// self::deleteLevel($section->id);
$section->delete();
}
}
}
| CWE-89 | 0 |
public function update()
{
global $DB;
global $events;
if(!is_array($this->categories))
$this->categories = array();
$ok = $DB->execute('
UPDATE nv_feeds
SET categories = :categories, format = :format, image = :image, entries = :entries,
content = :content, views = :views, permission = :permission, enabled = :enabled
WHERE id = :id AND website = :website',
array(
'id' => $this->id,
'website' => $this->website,
'categories' => implode(',', $this->categories),
'format' => $this->format,
'image' => value_or_default($this->image, 0),
'entries' => value_or_default($this->entries, 10),
'content' => $this->content,
'views' => value_or_default($this->views, 0),
'permission' => value_or_default($this->permission, 0),
'enabled' => value_or_default($this->enabled, 0)
)
);
if(!$ok)
throw new Exception($DB->get_last_error());
webdictionary::save_element_strings('feed', $this->id, $this->dictionary);
path::saveElementPaths('feed', $this->id, $this->paths);
if(method_exists($events, 'trigger'))
{
$events->trigger(
'feed',
'save',
array(
'feed' => $this
)
);
}
return true;
}
| CWE-79 | 1 |
public function delete()
{
global $DB;
global $user;
global $events;
$ok = false;
if($user->permission("themes.delete")=="false")
throw new Exception(t(610, "Sorry, you are not allowed to execute this function."));
if(file_exists(NAVIGATE_PATH.'/plugins/'.$this->code.'/'.$this->code.'.plugin'))
{
core_remove_folder(NAVIGATE_PATH.'/plugins/'.$this->code);
$ok = $DB->execute('
DELETE FROM nv_extensions
WHERE id = '.protect($this->id)
);
if(method_exists($events, 'trigger'))
{
$events->trigger(
'extension',
'delete',
array(
'extension' => $this
)
);
}
}
return $ok;
}
| CWE-89 | 0 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public function getTopRated(){
$url = "http://api.themoviedb.org/3/movie/top_rated?api_key=".$this->apikey;
$top_rated = $this->curl($url);
return $top_rated;
}
| CWE-89 | 0 |
$dt = date('Y-m-d', strtotime($match));
$sql = par_rep("/'$match'/", "'$dt'", $sql);
}
}
if (substr($sql, 0, 6) == "BEGIN;") {
$array = explode(";", $sql);
foreach ($array as $value) {
if ($value != "") {
$result = $connection->query($value);
if (!$result) {
$connection->query("ROLLBACK");
die(db_show_error($sql, _dbExecuteFailed, mysql_error()));
}
}
}
} else {
$result = $connection->query($sql) or die(db_show_error($sql, _dbExecuteFailed, mysql_error()));
}
break;
} | CWE-22 | 2 |
protected function _move($source, $targetDir, $name)
{
$target = $this->_joinPath($targetDir, $name);
return $this->connect->rename($source, $target) ? $target : false;
} | CWE-22 | 2 |
function critere_where_dist($idb, &$boucles, $crit) {
$boucle = &$boucles[$idb];
if (isset($crit->param[0])) {
$_where = calculer_liste($crit->param[0], $idb, $boucles, $boucle->id_parent);
} else {
$_where = '@$Pile[0]["where"]';
}
if ($crit->cond) {
$_where = "(($_where) ? ($_where) : '')";
}
if ($crit->not) {
$_where = "array('NOT',$_where)";
}
$boucle->where[] = $_where;
} | CWE-79 | 1 |
public function searchAdmin(){
$criteria = new CDbCriteria;
return $this->searchBase($criteria);
} | CWE-79 | 1 |
public function save()
{
global $DB;
if(!empty($this->id))
return $this->update();
else
return $this->insert();
}
| CWE-79 | 1 |
function edit() {
global $template;
parent::edit();
$allforms = array();
$allforms[""] = gt('Disallow Feedback');
// calculate which event date is the one being edited
$event_key = 0;
foreach ($template->tpl->tpl_vars['record']->value->eventdate as $key=>$d) {
if ($d->id == $this->params['date_id']) $event_key = $key;
}
assign_to_template(array(
'allforms' => array_merge($allforms, expTemplate::buildNameList("forms", "event/email", "tpl", "[!_]*")),
'checked_date' => !empty($this->params['date_id']) ? $this->params['date_id'] : null,
'event_key' => $event_key,
));
}
| CWE-89 | 0 |
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
| CWE-89 | 0 |
protected function optionsPage()
{
//FIXME Put Options code in here.
} | CWE-89 | 0 |
public function quicksearch($text)
{
global $DB;
global $website;
$like = ' LIKE '.protect('%'.$text.'%');
// we search for the IDs at the dictionary NOW (to avoid inefficient requests)
$DB->query('SELECT DISTINCT (nvw.node_id)
FROM nv_webdictionary nvw
WHERE nvw.node_type = "feed"
AND nvw.website = '.$website->id.'
AND nvw.text '.$like, 'array');
$dict_ids = $DB->result("node_id");
// all columns to look for
$cols[] = 'i.id' . $like;
if(!empty($dict_ids))
$cols[] = 'i.id IN ('.implode(',', $dict_ids).')';
$where = ' AND ( ';
$where.= implode( ' OR ', $cols);
$where .= ')';
return $where;
}
| CWE-79 | 1 |
protected function initServiceMode($request)
{
$config = $this->Application()->Config();
if (!empty($config->setOffline) && strpos($config->offlineIp, $request->getClientIp()) === false) {
if ($request->getControllerName() !== 'error') {
$request->setControllerName('error')->setActionName('service')->setDispatched(false);
}
}
} | CWE-601 | 11 |
public function save()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) {
if ($this->categoryModel->create($values) !== false) {
$this->flash->success(t('Your category have been created successfully.'));
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);
return;
} else {
$errors = array('name' => array(t('Another category with the same name exists in this project')));
}
}
$this->create($values, $errors);
} | CWE-639 | 9 |
public static function checkPermissions($permission,$location) {
global $exponent_permissions_r, $router;
// only applies to the 'manage' method
if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) {
if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) {
foreach ($page as $pageperm) {
if (!empty($pageperm['manage'])) return true;
}
}
}
return false;
}
| CWE-89 | 0 |
public static function id($userid){
$usr = Db::result(
sprintf("SELECT * FROM `user` WHERE `userid` = '%s' LIMIT 1",
Typo::cleanX($userid)
)
);
return $usr[0]->id;
}
| CWE-89 | 0 |
public function sdm_save_other_details_meta_data($post_id) { // Save Statistics Upload metabox
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (!isset($_POST['sdm_other_details_nonce_check']) || !wp_verify_nonce($_POST['sdm_other_details_nonce_check'], 'sdm_other_details_nonce')) {
return;
}
if (isset($_POST['sdm_item_file_size'])) {
update_post_meta($post_id, 'sdm_item_file_size', $_POST['sdm_item_file_size']);
}
if (isset($_POST['sdm_item_version'])) {
update_post_meta($post_id, 'sdm_item_version', $_POST['sdm_item_version']);
}
} | CWE-79 | 1 |
foreach ($cf_d as $cfd_i => $cfd_d) {
if ($cfd_i == 'TYPE') {
$fc = substr($cfd_d, 0, 1);
$lc = substr($cfd_d, 1);
$cfd_d = strtoupper($fc) . $lc;
$get_schools_cf[$cf_i][$cfd_i] = $cfd_d;
unset($fc);
unset($lc);
}
if ($cfd_i == 'SELECT_OPTIONS' && $cf_d['TYPE'] != 'text') {
for ($i = 0; $i < strlen($cfd_d); $i++) {
$char = substr($cfd_d, $i, 1);
if (ord($char) == '13')
$char = '<br/>';
$new_char[] = $char;
}
$cfd_d = implode('', $new_char);
$get_schools_cf[$cf_i][$cfd_i] = $cfd_d;
unset($char);
unset($new_char);
}
if ($cfd_i == 'SYSTEM_FIELD' || $cfd_i == 'REQUIRED') {
if ($cfd_d == 'N')
$get_schools_cf[$cf_i][$cfd_i] = 'No';
if ($cfd_d == 'Y')
$get_schools_cf[$cf_i][$cfd_i] = 'Yes';
}
} | CWE-22 | 2 |
public function saveNewUpload(UploadedFile $uploadedFile, $page_id)
{
$attachmentName = $uploadedFile->getClientOriginalName();
$attachmentPath = $this->putFileInStorage($uploadedFile);
$largestExistingOrder = Attachment::where('uploaded_to', '=', $page_id)->max('order');
$attachment = Attachment::forceCreate([
'name' => $attachmentName,
'path' => $attachmentPath,
'extension' => $uploadedFile->getClientOriginalExtension(),
'uploaded_to' => $page_id,
'created_by' => user()->id,
'updated_by' => user()->id,
'order' => $largestExistingOrder + 1,
]);
return $attachment;
} | CWE-22 | 2 |
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 |
function db_case($array)
{
global $DatabaseType;
$counter = 0;
if ($DatabaseType == 'mysqli') {
$array_count = count($array);
$string = " CASE WHEN $array[0] =";
$counter++;
$arr_count = count($array);
for ($i = 1; $i < $arr_count; $i++) {
$value = $array[$i];
if ($value == "''" && substr($string, -1) == '=') {
$value = ' IS NULL';
$string = substr($string, 0, -1);
}
$string .= "$value";
if ($counter == ($array_count - 2) && $array_count % 2 == 0)
$string .= " ELSE ";
elseif ($counter == ($array_count - 1))
$string .= " END ";
elseif ($counter % 2 == 0)
$string .= " WHEN $array[0]=";
elseif ($counter % 2 == 1)
$string .= " THEN ";
$counter++;
}
}
return $string;
} | CWE-79 | 1 |
Subsets and Splits