code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
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 global_cache_key($dir = true)
{
$cache_key = $_SERVER['REQUEST_URI'];
$cache_key = str_replace('/', '-', $cache_key);
$cache_key = mso_slug(' ' . $cache_key);
if (!$cache_key) $cache_key = 'home'; // главная
if ($dir) $cache_key = 'html/' . $cache_key . '.html';
else $cache_key = $cache_key . '.html';
return $cache_key;
}
| CWE-79 | 1 |
public function withHeader($header, $value)
{
/** @var Request $newInstance */
$newInstance = $this->withParentHeader($header, $value);
return $newInstance;
} | CWE-89 | 0 |
public function setModel(Model $model)
{
$this->model = $model;
$this->extensions = $this->model->getAllowedExtensions();
$this->from($this->model->getObjectTypeDirName());
return $this;
} | CWE-22 | 2 |
function get_language_attributes( $doctype = 'html' ) {
$attributes = array();
if ( function_exists( 'is_rtl' ) && is_rtl() )
$attributes[] = 'dir="rtl"';
if ( $lang = get_bloginfo('language') ) {
if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
$attributes[] = "lang=\"$lang\"";
if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
$attributes[] = "xml:lang=\"$lang\"";
}
$output = implode(' ', $attributes);
/**
* Filters the language attributes for display in the html tag.
*
* @since 2.5.0
* @since 4.3.0 Added the `$doctype` parameter.
*
* @param string $output A space-separated list of language attributes.
* @param string $doctype The type of html document (xhtml|html).
*/
return apply_filters( 'language_attributes', $output, $doctype );
} | CWE-79 | 1 |
$this->paths[substr($key, strlen('path-'))] = $value;
}
| CWE-79 | 1 |
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar'); | CWE-22 | 2 |
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 |
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-94 | 14 |
public function subscriptions() {
global $db;
expHistory::set('manageable', $this->params);
// make sure we have what we need.
if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.'));
if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.'));
// verify the id/key pair
$sub = new subscribers($this->params['id']);
if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));
// get this users subscriptions
$subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id);
// get a list of all available E-Alerts
$ealerts = new expeAlerts();
assign_to_template(array(
'subscriber'=>$sub,
'subscriptions'=>$subscriptions,
'ealerts'=>$ealerts->find('all')
));
} | CWE-89 | 0 |
function gce_ajax_list() {
$nonce = $_POST['gce_nonce'];
// check to see if the submitted nonce matches with the
// generated nonce we created earlier
if ( ! wp_verify_nonce( $nonce, 'gce_ajax_nonce' ) ) {
die ( 'Request has failed.');
}
$grouped = $_POST['gce_grouped'];
$start = $_POST['gce_start'];
$ids = $_POST['gce_feed_ids'];
$title_text = $_POST['gce_title_text'];
$sort = $_POST['gce_sort'];
$paging = $_POST['gce_paging'];
$paging_interval = $_POST['gce_paging_interval'];
$paging_direction = $_POST['gce_paging_direction'];
$start_offset = $_POST['gce_start_offset'];
$paging_type = $_POST['gce_paging_type'];
if( $paging_direction == 'back' ) {
if( $paging_type == 'month' ) {
$this_month = mktime( 0, 0, 0, date( 'm', $start ) - 1, 1, date( 'Y', $start ) );
$prev_month = mktime( 0, 0, 0, date( 'm', $start ) - 2, 1, date( 'Y', $start ) );
$prev_interval_days = date( 't', $prev_month );
$month_days = date( 't', $this_month );
$int = $month_days + $prev_interval_days;
$int = $int * 86400;
$start = $start - ( $int );
$changed_month_days = date( 't', $start );
$paging_interval = $changed_month_days * 86400;
} else {
$start = $start - ( $paging_interval * 2 );
}
} else {
if( $paging_type == 'month' ) {
$days_in_month = date( 't', $start );
$paging_interval = 86400 * $days_in_month;
}
}
$d = new GCE_Display( explode( '-', $ids ), $title_text, $sort );
echo $d->get_list( $grouped, $start, $paging, $paging_interval, $start_offset );
die();
} | CWE-79 | 1 |
function dump() {
if (!$this->output)
$this->output = fopen('php://output', 'w');
// Detect delimeter from the current locale settings. For locales
// which use comma (,) as the decimal separator, the semicolon (;)
// should be used as the field separator
$delimiter = ',';
if (class_exists('NumberFormatter')) {
$nf = NumberFormatter::create(Internationalization::getCurrentLocale(),
NumberFormatter::DECIMAL);
$s = $nf->getSymbol(NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
if ($s == ',')
$delimiter = ';';
}
// Output a UTF-8 BOM (byte order mark)
fputs($this->output, chr(0xEF) . chr(0xBB) . chr(0xBF));
fputcsv($this->output, $this->getHeaders(), $delimiter);
while ($row=$this->next())
fputcsv($this->output, $row, $delimiter);
fclose($this->output);
} | CWE-1236 | 12 |
public static function remove_old_unconfirmed_accounts()
{
global $DB;
global $website;
$ok = false;
$DB->query('
SELECT ex.id
FROM (
SELECT id, activation_key, SUBSTRING_INDEX(activation_key, "-", -1) AS expiration_time
FROM nv_webusers
WHERE website = ' . protect($website->id) . '
AND access = 1
AND activation_key != ""
) ex
WHERE ex.activation_key <> ex.expiration_time
AND '.time().' > ex.expiration_time
');
$rs = $DB->result('id');
if(!empty($rs))
{
$ok = $DB->execute('
DELETE FROM nv_webusers wu
WHERE wu.id IN ('.implode(",", $rs).')
');
}
if($ok)
return count($rs);
else
return 0;
}
| CWE-89 | 0 |
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 |
public function actionEditDropdown() {
$model = new Dropdowns;
if (isset($_POST['Dropdowns'])) {
$model = Dropdowns::model()->findByPk(
$_POST['Dropdowns']['id']);
if ($model->id == Actions::COLORS_DROPDOWN_ID) {
if (AuxLib::issetIsArray($_POST['Dropdowns']['values']) &&
AuxLib::issetIsArray($_POST['Dropdowns']['labels']) &&
count($_POST['Dropdowns']['values']) ===
count($_POST['Dropdowns']['labels'])) {
if (AuxLib::issetIsArray($_POST['Admin']) &&
isset($_POST['Admin']['enableColorDropdownLegend'])) {
Yii::app()->settings->enableColorDropdownLegend =
$_POST['Admin']['enableColorDropdownLegend'];
Yii::app()->settings->save();
}
$options = array_combine(
$_POST['Dropdowns']['values'], $_POST['Dropdowns']['labels']);
$temp = array();
foreach ($options as $value => $label) {
if ($value != "")
$temp[$value] = $label;
}
$model->options = json_encode($temp);
$model->save();
}
} else {
$model->attributes = $_POST['Dropdowns'];
$temp = array();
if (is_array($model->options) && count($model->options) > 0) {
foreach ($model->options as $option) {
if ($option != "")
$temp[$option] = $option;
}
$model->options = json_encode($temp);
if ($model->save()) {
}
}
}
}
$this->redirect(
'manageDropDowns'
);
} | CWE-79 | 1 |
public function getOnClickAction() {
return 'javascript:openNewGal(\''.$this->stack_name.'\');';
} | CWE-79 | 1 |
public function providesExceptionData() {
$notFoundEnvMessage = 'Not found in env';
$notFoundEnvException = new NotFoundEnvException($notFoundEnvMessage);
$notFoundEnvStatus = Http::STATUS_NOT_FOUND;
$notFoundServiceMessage = 'Not found in service';
$notFoundServiceException = new NotFoundServiceException($notFoundServiceMessage);
$notFoundServiceStatus = Http::STATUS_NOT_FOUND;
$forbiddenServiceMessage = 'Forbidden in service';
$forbiddenServiceException = new ForbiddenServiceException($forbiddenServiceMessage);
$forbiddenServiceStatus = Http::STATUS_FORBIDDEN;
$errorServiceMessage = 'Broken service';
$errorServiceException = new InternalServerErrorServiceException($errorServiceMessage);
$errorServiceStatus = Http::STATUS_INTERNAL_SERVER_ERROR;
$coreServiceMessage = 'Broken core';
$coreServiceException = new \Exception($coreServiceMessage);
$coreServiceStatus = Http::STATUS_INTERNAL_SERVER_ERROR;
return [
[$notFoundEnvException, $notFoundEnvMessage, $notFoundEnvStatus],
[$notFoundServiceException, $notFoundServiceMessage, $notFoundServiceStatus],
[$forbiddenServiceException, $forbiddenServiceMessage, $forbiddenServiceStatus],
[$errorServiceException, $errorServiceMessage, $errorServiceStatus],
[$coreServiceException, $coreServiceMessage, $coreServiceStatus]
];
} | CWE-79 | 1 |
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 fsock_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp)
{
$connect_timeout = 3;
$connect_try = 3;
$method = 'GET';
$readsize = 4096;
$ssl = '';
$getSize = null;
$headers = '';
$arr = parse_url($url);
if (!$arr) {
// Bad request
return false;
}
if ($arr['scheme'] === 'https') {
$ssl = 'ssl://';
}
// query
$arr['query'] = isset($arr['query']) ? '?' . $arr['query'] : '';
// port
$port = isset($arr['port']) ? $arr['port'] : '';
$arr['port'] = $port ? $port : ($ssl ? 443 : 80);
$url_base = $arr['scheme'] . '://' . $arr['host'] . ($port ? (':' . $port) : ''); | CWE-918 | 16 |
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 showall() {
expHistory::set('viewable', $this->params);
$hv = new help_version();
//$current_version = $hv->find('first', 'is_current=1');
$ref_version = $hv->find('first', 'version=\''.$this->help_version.'\'');
// pagination parameter..hard coded for now.
$where = $this->aggregateWhereClause();
$where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id); | CWE-89 | 0 |
foreach($item as $subtype => $litem)
{
if(strpos($subtype, 'section-')===0)
{
if($litem=='<p><br _mce_bogus="1"></p>') continue; // tinymce empty contents, no need to save it
// has the text been changed since last save?
$last_litem = $DB->query_single(
'`text`',
'nv_webdictionary_history',
' node_id = '.protect($node_id).' AND
website = '.protect($website_id).' AND
lang = '.protect($lang).' AND
subtype = '.protect($subtype).' AND
node_type = '.protect($node_type).' AND
autosave = '.protect(($autosave)? '1' : '0').'
ORDER BY date_created DESC
'
);
if($last_litem != $litem)
{
$changed = true;
// autocleaning
if($autosave)
{
// remove previous autosaved elements
$DB->execute('
DELETE FROM nv_webdictionary_history
WHERE node_id = '.protect($node_id).' AND
website = '.protect($website_id).' AND
lang = '.protect($lang).' AND
subtype = '.protect($subtype).' AND
node_type = '.protect($node_type).' AND
autosave = 1 AND
date_created < '.(core_time() - 86400 * 7)
);
}
$DB->execute('
INSERT INTO nv_webdictionary_history
(id, website, node_type, node_id, subtype, lang, `text`, date_created, autosave)
VALUES
( 0, :website, :node_type, :node_id, :subtype, :lang, :text, :date_created, :autosave)
',
array(
":website" => $website_id,
":node_type" => $node_type,
":node_id" => $node_id,
":subtype" => $subtype,
":lang" => $lang,
":text" => $litem,
":date_created" => core_time(),
":autosave" => ($autosave)? '1' : '0'
)
);
}
}
| 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 |
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()
{
$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 getFolderIdentifiersInFolder($folderIdentifier, $useFilters = true, $recursive = false)
{
$filters = $useFilters == true ? $this->fileAndFolderNameFilters : [];
return $this->driver->getFoldersInFolder($folderIdentifier, 0, 0, $recursive, $filters);
} | CWE-319 | 8 |
protected function getCustomDefinitionService()
{
return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition();
} | CWE-89 | 0 |
function duplicate($options = []) {
$input = $this->fields;
unset($input['id']);
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
if (isset($this->fields[$key])) {
$input[$key] = $val;
}
}
}
if ($newID = $this->clone($input)) {
$this->updateDurationCache($newID);
return true;
}
return false;
} | CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$link_id = $this->request->getIntegerParam('link_id');
$link = $this->taskExternalLinkModel->getById($link_id);
if (empty($link)) {
throw new PageNotFoundException();
}
$this->response->html($this->template->render('task_external_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | CWE-639 | 9 |
foreach($gc as $gcc=>$gcd)
{
if($gcd!='' && $gcc!='GRADE_LEVEL')
{
$sql_columns[]=$gcc;
$sql_values[]="'".$gcd."'";
}
if($gcd!='' && $gcc=='GRADE_LEVEL')
{
foreach($get_cs_grade as $gcsgi=>$gcsgd)
{
if($gcd==$gcsd['ID'])
{
$sql_columns[]='GRADE_LEVEL';
$sql_values[]="'".$get_ts_grade[$gcsgi]['ID']."'";
}
}
}
} | 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(""",'"',$str);
$str = str_replace("'","'",$str);
$str = str_replace("’","'",$str);
$str = str_replace("‘","'",$str);
$str = str_replace("®","",$str);
$str = str_replace("�","-", $str);
$str = str_replace("�","-", $str);
$str = str_replace("�", '"', $str);
$str = str_replace("”",'"', $str);
$str = str_replace("�", '"', $str);
$str = str_replace("“",'"', $str);
$str = str_replace("\r\n"," ",$str);
$str = str_replace("�"," 1/4",$str);
$str = str_replace("¼"," 1/4", $str);
$str = str_replace("�"," 1/2",$str);
$str = str_replace("½"," 1/2",$str);
$str = str_replace("�"," 3/4",$str);
$str = str_replace("¾"," 3/4",$str);
$str = str_replace("�", "(TM)", $str);
$str = str_replace("™","(TM)", $str);
$str = str_replace("®","(R)", $str);
$str = str_replace("�","(R)",$str);
$str = str_replace("&","&",$str);
$str = str_replace(">",">",$str);
return trim($str);
} | 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 |
function getTextColumns($table) {
$sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'";
$res = @mysqli_query($this->connection, $sql);
if ($res == null)
return array();
$records = array();
while($row = mysqli_fetch_object($res)) {
$records[] = $row->Field;
}
return $records;
} | 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 |
static function description() {
return "Manage events and schedules, and optionally publish them.";
}
| CWE-89 | 0 |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| CWE-89 | 0 |
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('tax_rates.php', 'page=' . $_GET['page']), null, null, 'btn-light')]; | CWE-79 | 1 |
public function toCompiled()
{
return $this->processor->processUpdate($this, []);
} | CWE-79 | 1 |
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 function getQueryOrderby()
{
return '`' . $this->name . '`';
} | CWE-89 | 0 |
public function testAddAndRemoveQueryValues()
{
$uri = new Uri('http://foo.com/bar');
$uri = Uri::withQueryValue($uri, 'a', 'b');
$uri = Uri::withQueryValue($uri, 'c', 'd');
$uri = Uri::withQueryValue($uri, 'e', null);
$this->assertEquals('a=b&c=d&e', $uri->getQuery());
$uri = Uri::withoutQueryValue($uri, 'c');
$uri = Uri::withoutQueryValue($uri, 'e');
$this->assertEquals('a=b', $uri->getQuery());
$uri = Uri::withoutQueryValue($uri, 'a');
$uri = Uri::withoutQueryValue($uri, 'a');
$this->assertEquals('', $uri->getQuery());
} | CWE-89 | 0 |
$resource = fopen($request->getUri(), 'r', null, $context);
$this->lastHeaders = $http_response_header;
return $resource;
}
); | CWE-89 | 0 |
. PMA_Util::getIcon('b_favorite.png')
. '</a>';
$html .= '<a href="sql.php?server=' . $GLOBALS['server']
. '&db=' . $table['db']
. '&table=' . $table['table']
. '&token=' . $_SESSION[' PMA_token ']
. '">`' . $table['db'] . '`.`' . $table['table'] . '`</a>';
$html .= '</li>';
}
}
} else {
$html .= '<li class="warp_link">'
. ($this->_tableType == 'recent'
?__('There are no recent tables.')
:__('There are no favorite tables.'))
. '</li>';
} | CWE-79 | 1 |
public function rules()
{
$rules = [
'username' => 'required|unique:users,username',
'email' => 'unique:users,email',
];
return $rules;
} | CWE-190 | 19 |
static function description() { return gt("Places navigation links/menus on the page."); }
| CWE-89 | 0 |
public function testLegacyDispatch()
{
$event = new Event();
$return = $this->dispatcher->dispatch(self::preFoo, $event);
$this->assertEquals('pre.foo', $event->getName());
} | CWE-89 | 0 |
function delete_vendor() {
global $db;
if (!empty($this->params['id'])){
$db->delete('vendor', 'id =' .$this->params['id']);
}
expHistory::back();
} | CWE-89 | 0 |
public function autocomplete() {
return;
global $db;
$model = $this->params['model'];
$mod = new $model();
$srchcol = explode(",",$this->params['searchoncol']);
/*for ($i=0; $i<count($srchcol); $i++) {
if ($i>=1) $sql .= " OR ";
$sql .= $srchcol[$i].' LIKE \'%'.$this->params['query'].'%\'';
}*/
// $sql .= ' AND parent_id=0';
//eDebug($sql);
//$res = $mod->find('all',$sql,'id',25);
$sql = "select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from ".$db->prefix."product as p INNER JOIN ".$db->prefix."content_expfiles as cef ON p.id=cef.content_id INNER JOIN ".$db->prefix."expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') desc LIMIT 25";
//$res = $db->selectObjectsBySql($sql);
//$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`');
$ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res);
$ar->send();
} | CWE-89 | 0 |
public function getQueryOrderby()
{
$uh = UserHelper::instance();
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return $R2 . "." . str_replace('user.', '', $uh->getDisplayNameSQLOrder());
} | CWE-89 | 0 |
public function elements_count()
{
global $DB;
global $webuser;
$permission = (!empty($_SESSION['APP_USER#'.APP_UNIQUE])? 1 : 0);
// public access / webuser based / webuser groups based
$access = 2;
if(!empty($current['webuser']))
{
$access = 1;
if(!empty($webuser->groups))
{
$access_groups = array();
foreach($webuser->groups as $wg)
{
if(empty($wg))
continue;
$access_groups[] = 'groups LIKE "%g'.$wg.'%"';
}
if(!empty($access_groups))
$access_extra = ' OR (access = 3 AND ('.implode(' OR ', $access_groups).'))';
}
}
$out = $DB->query_single(
'COUNT(id)',
'nv_items',
' category = '.protect($this->id).' AND
website = '.protect($this->website).' AND
permission <= '.$permission.' AND
(date_published = 0 OR date_published < '.core_time().') AND
(date_unpublish = 0 OR date_unpublish > '.core_time().') AND
(access = 0 OR access = '.$access.$access_extra.')
');
return $out;
}
| CWE-89 | 0 |
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-22 | 2 |
public function getQuerySelect()
{
return '';
} | CWE-89 | 0 |
foreach ($week as $dayNum => $day) {
if ($dayNum == $now['mday']) {
$currentweek = $weekNum;
}
if ($dayNum <= $endofmonth) {
// $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $db->countObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1;
$monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $ed->find("count", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1;
}
}
| CWE-89 | 0 |
public function toCompiled()
{
return $this->processor->processUpdate($this, []);
} | CWE-22 | 2 |
function db_start()
{
global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType, $connection;
switch ($DatabaseType) {
case 'mysqli':
$connection = new ConnectDBOpensis();
if ($connection->auto_init == true) {
$connection = $connection->init($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);
mysqli_set_charset($connection, "utf8");
}
break;
}
// Error code for both.
if ($connection === false) {
switch ($DatabaseType) {
case 'mysqli':
$errormessage = mysqli_error($connection);
break;
}
db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errstring);
}
return $connection;
} | CWE-22 | 2 |
public function clean($html) {
$antiXss = new \voku\helper\AntiXSS();
$html = $antiXss->xss_clean($html);
$config = \HTMLPurifier_Config::createDefault();
if ($this->purifierPath) {
$config->set('Cache.SerializerPath', $this->purifierPath);
}
if ($this->purifierPath) {
$config->set('Cache.SerializerPath', $this->purifierPath);
}
$config->set('URI.DisableExternal', true);
$config->set('URI.DisableExternalResources', true);
// $config->set('URI.DisableResources', true);
$config->set('URI.Host', site_hostname());
$purifier = new \HTMLPurifier($config);
$html = $purifier->purify($html);
return $html;
} | CWE-79 | 1 |
public function testReturnsIdentityWhenRemovingMissingHeader()
{
$r = new Response();
$this->assertSame($r, $r->withoutHeader('foo'));
} | CWE-89 | 0 |
$rst[$key] = self::parseAndTrim($st, $unescape);
}
return $rst;
}
$str = str_replace("<br>"," ",$str);
$str = str_replace("</br>"," ",$str);
$str = str_replace("<br/>"," ",$str);
$str = str_replace("<br />"," ",$str);
$str = str_replace("\r\n"," ",$str);
$str = str_replace('"',""",$str);
$str = str_replace("'","'",$str);
$str = str_replace("’","’",$str);
$str = str_replace("‘","‘",$str);
$str = str_replace("®","®",$str);
$str = str_replace("–","-", $str);
$str = str_replace("—","—", $str);
$str = str_replace("”","”", $str);
$str = str_replace("“","“", $str);
$str = str_replace("¼","¼",$str);
$str = str_replace("½","½",$str);
$str = str_replace("¾","¾",$str);
$str = str_replace("™","™", $str);
$str = trim($str);
if ($unescape) {
$str = stripcslashes($str);
} else {
$str = addslashes($str);
}
return $str;
} | CWE-89 | 0 |
public function comments_count()
{
global $DB;
if(empty($this->_comments_count))
{
$DB->query('
SELECT COUNT(*) as total
FROM nv_comments
WHERE website = ' . protect($this->website) . '
AND object_type = "item"
AND object_id = ' . protect($this->id) . '
AND status = 0'
);
$out = $DB->result('total');
$this->_comments_count = $out[0];
}
return $this->_comments_count;
}
| CWE-89 | 0 |
function searchCategory() {
return gt('Event');
}
| CWE-89 | 0 |
public function update()
{
try {
$_recipients = array();
if ($this->recipients != null) {
foreach ($this->recipients as $_r) {
$_recipients[$_r->id] = $_r->sname . ' <' . $_r->email . '>';
}
}
$sender = ($this->sender === 0) ?
new Expression('NULL') : $this->sender;
$sender_name = ($this->sender_name === null) ?
new Expression('NULL') : $this->sender_name;
$sender_address = ($this->sender_address === null) ?
new Expression('NULL') : $this->sender_address;
$values = array(
'mailing_sender' => $sender,
'mailing_sender_name' => $sender_name,
'mailing_sender_address' => $sender_address,
'mailing_subject' => $this->subject,
'mailing_body' => $this->message,
'mailing_date' => $this->date,
'mailing_recipients' => serialize($_recipients),
'mailing_sent' => ($this->sent) ?
true :
($this->zdb->isPostgres() ? 'false' : 0)
);
$update = $this->zdb->update(self::TABLE);
$update->set($values);
$update->where(self::PK . ' = ' . $this->mailing->history_id);
$this->zdb->execute($update);
return true;
} catch (Throwable $e) {
Analog::log(
'An error occurend updating Mailing | ' . $e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
public function approve_submit() {
global $history;
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
$lastUrl = expHistory::getLast('editable');
}
/* 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']);
//FIXME here is where we might sanitize the note before approving it
$simplenote->body = $this->params['body'];
$simplenote->approved = $this->params['approved'];
$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 actionSeoFileLink($url, $robots = '', $canonical = '', $inline = true, $fileName = '')
{
$url = base64_decode($url);
$robots = base64_decode($robots);
$canonical = base64_decode($canonical);
$url = UrlHelper::absoluteUrlWithProtocol($url);
$contents = file_get_contents($url);
$response = Craft::$app->getResponse();
if ($contents) {
// Add the X-Robots-Tag header
if (!empty($robots)) {
$headerValue = $robots;
$response->headers->add('X-Robots-Tag', $headerValue);
}
// Add the Link header
if (!empty($canonical)) {
$headerValue = '<'.$canonical.'>; rel="canonical"';
$response->headers->add('Link', $headerValue);
}
// Ensure the file type is allowed
// ref: https://craftcms.com/docs/3.x/config/config-settings.html#allowedfileextensions
$allowedExtensions = Craft::$app->getConfig()->getGeneral()->allowedFileExtensions;
if (($ext = pathinfo($fileName, PATHINFO_EXTENSION)) !== '') {
$ext = strtolower($ext);
}
if ($ext === '' || !in_array($ext, $allowedExtensions, true)) {
throw new ServerErrorHttpException(Craft::t('seomatic', 'File format not allowed.'));
}
// Send the file as a stream, so it can exist anywhere
$response->sendContentAsFile(
$contents,
$fileName,
[
'inline' => $inline,
'mimeType' => FileHelper::getMimeTypeByExtension($fileName)
]
);
} else {
throw new NotFoundHttpException(Craft::t('seomatic', 'File not found.'));
}
return $response;
} | CWE-79 | 1 |
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_DELETE, 'fas fa-trash', null, 'primary', null, 'btn-danger xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('specials.php', 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id), null, null, 'btn-light')]; | CWE-79 | 1 |
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' => 'posts',
'key' => $vars
);
$post = Db::insert($ins);
self::$last_id = Db::$last_id;
Hooks::run('post_sqladd_action', $vars, self::$last_id);
$pinger = Options::v('pinger');
if ($pinger != "") {
Pinger::run($pinger);
}
}
return $post;
}
| CWE-89 | 0 |
function clean_input_value($value) {
if (is_string($value)) {
return descript($value);
}
if (is_array($value)) {
return array_map('descript', $value);
}
return '';
} | CWE-79 | 1 |
$file_link = explode(" ", trim($row['file']))[0];
// If the link has no "http://" in front, then add it
if (substr(strtolower($file_link), 0, 4) !== 'http') {
$file_link = 'http://' . $file_link;
}
echo '<td><a href="http://anonym.to/?' . $file_link . '" target="_blank"><img class="icon" src="images/warning.png"/>http://anonym.to/?' . $file_link . '</a></td>';
echo '<td><a href="include/play.php?f=' . $row['session'] . '" target="_blank"><img class="icon" src="images/play.ico"/>Play</a></td>';
echo '<td><a href="kippo-scanner.php?file_url=' . $file_link . '" target="_blank">Scan File</a></td>';
echo '</tr>';
$counter++;
}
//Close tbody and table element, it's ready.
echo '</tbody></table>';
echo '<hr /><br />';
} | CWE-79 | 1 |
public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) {
$opts = $this->opts;
$volOpts = $volume->getOptionsPlugin('AutoResize');
if (is_array($volOpts)) {
$opts = array_merge($this->opts, $volOpts);
}
if (! $opts['enable']) {
return false;
}
$srcImgInfo = @getimagesize($src);
if ($srcImgInfo === false) {
return false;
}
// 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;
}
if ($srcImgInfo[0] > $opts['maxWidth'] || $srcImgInfo[1] > $opts['maxHeight']) {
return $this->resize($src, $srcImgInfo, $opts['maxWidth'], $opts['maxHeight'], $opts['quality'], $opts['preserveExif']);
}
return false;
} | CWE-89 | 0 |
public function testParsesProvidedUrl()
{
$uri = new Uri('https://michael:[email protected]:443/path/123?q=abc#test');
// Standard port 443 for https gets ignored.
$this->assertEquals(
'https://michael:[email protected]/path/123?q=abc#test',
(string) $uri
);
$this->assertEquals('test', $uri->getFragment());
$this->assertEquals('test.com', $uri->getHost());
$this->assertEquals('/path/123', $uri->getPath());
$this->assertEquals(null, $uri->getPort());
$this->assertEquals('q=abc', $uri->getQuery());
$this->assertEquals('https', $uri->getScheme());
$this->assertEquals('michael:test', $uri->getUserInfo());
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('SELECT * FROM nv_webuser_votes WHERE website = '.protect($website->id), 'object');
if($type='json')
$out = json_encode($DB->result());
return $out;
}
| CWE-89 | 0 |
private function applyParts(array $parts)
{
$this->scheme = isset($parts['scheme'])
? $this->filterScheme($parts['scheme'])
: '';
$this->userInfo = isset($parts['user']) ? $parts['user'] : '';
$this->host = isset($parts['host']) ? $parts['host'] : '';
$this->port = !empty($parts['port'])
? $this->filterPort($this->scheme, $this->host, $parts['port'])
: null;
$this->path = isset($parts['path'])
? $this->filterPath($parts['path'])
: '';
$this->query = isset($parts['query'])
? $this->filterQueryAndFragment($parts['query'])
: '';
$this->fragment = isset($parts['fragment'])
? $this->filterQueryAndFragment($parts['fragment'])
: '';
if (isset($parts['pass'])) {
$this->userInfo .= ':' . $parts['pass'];
}
} | CWE-89 | 0 |
public function options($hash) {
$create = $createext = array();
if (isset($this->archivers['create']) && is_array($this->archivers['create'])) {
foreach($this->archivers['create'] as $m => $v) {
$create[] = $m;
$createext[$m] = $v['ext'];
}
}
return array(
'path' => $this->path($hash),
'url' => $this->URL,
'tmbUrl' => $this->tmbURL,
'disabled' => $this->disabled,
'separator' => $this->separator,
'copyOverwrite' => intval($this->options['copyOverwrite']),
'uploadOverwrite' => intval($this->options['uploadOverwrite']),
'uploadMaxSize' => intval($this->uploadMaxSize),
'dispInlineRegex' => $this->options['dispInlineRegex'],
'jpgQuality' => intval($this->options['jpgQuality']),
'archivers' => array(
'create' => $create,
'extract' => isset($this->archivers['extract']) && is_array($this->archivers['extract']) ? array_keys($this->archivers['extract']) : array(),
'createext' => $createext
),
'uiCmdMap' => (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array(),
'syncChkAsTs' => intval($this->options['syncChkAsTs']),
'syncMinMs' => intval($this->options['syncMinMs'])
);
} | CWE-89 | 0 |
function get_filedisplay_views() {
expTemplate::get_filedisplay_views();
$paths = array(
BASE.'framework/modules/common/views/file/',
BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/',
);
$views = array();
foreach ($paths as $path) {
if (is_readable($path)) {
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') {
$filename = substr($file, 0, -4);
$views[$filename] = gt($filename);
}
}
}
}
return $views;
} | CWE-89 | 0 |
public static function countries($lang="", $alpha3=false)
{
global $DB;
global $user;
// static function can be called from navigate or from a webget (user then is not a navigate user)
if(empty($lang))
$lang = $user->language;
$code = 'country_code';
if($alpha3)
$code = 'alpha3';
$DB->query('SELECT '.$code.' AS country_code, name
FROM nv_countries
WHERE lang = '.protect($lang).'
ORDER BY name ASC');
$rs = $DB->result();
if(empty($rs))
{
// failback, load English names
$DB->query('SELECT '.$code.' AS country_code, name
FROM nv_countries
WHERE lang = "en"
ORDER BY name ASC');
$rs = $DB->result();
}
$out = array();
foreach($rs as $country)
{
$out[$country->country_code] = $country->name;
}
return $out;
}
| 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 |
$this->_writeCsv($plugin, $tmpDir . $plugin . DS);
}
/* site_configsの編集 (email / google_analytics_id / version) */
$targets = ['email', 'google_analytics_id', 'version'];
$path = $tmpDir . 'site_configs.csv';
$fp = fopen($path, 'a+');
$records = [];
while(($record = fgetcsvReg($fp, 10240)) !== false) {
if (in_array($record[1], $targets)) {
$record[2] = '';
}
$records[] = '"' . implode('","', $record) . '"';
}
ftruncate($fp, 0);
fwrite($fp, implode("\n", $records));
/* ZIPに固めてダウンロード */
$fileName = 'default';
$Simplezip = new Simplezip();
$Simplezip->addFolder($tmpDir);
$Simplezip->download($fileName);
emptyFolder($tmpDir);
exit();
} | CWE-78 | 6 |
private static function notifyAction()
{
if (! wCMS::$loggedIn) {
return;
}
if (! wCMS::$currentPageExists) {
wCMS::alert('info', '<b>This page (' . wCMS::$currentPage . ') doesn\'t exist.</b> Click inside the content below to create it.');
}
if (wCMS::get('config', 'login') === 'loginURL') {
wCMS::alert('warning', 'Change the default admin login URL. (<i>Settings -> Security</i>)', true);
}
if (password_verify('admin', wCMS::get('config', 'password'))) {
wCMS::alert('danger', 'Change the default password. (<i>Settings -> Security</i>)', true);
}
$repoVersion = wCMS::getOfficialVersion();
if ($repoVersion != version) {
wCMS::alert('info', '<b>New WonderCMS update available.</b><p>- Backup your website and check <a href="https://wondercms.com/whatsnew" target="_blank">what\'s new</a> before updating.</p><form action="' . wCMS::url(wCMS::$currentPage) . '" method="post" class="marginTop5"><button type="submit" class="btn btn-info" name="backup">Create backup</button><input type="hidden" name="token" value="' . wCMS::generateToken() . '"></form><form action="" method="post" class="marginTop5"><button class="btn btn-info" name="upgrade">Update WonderCMS</button><input type="hidden" name="token" value="' . wCMS::generateToken() . '"></form>', true);
}
}
| CWE-22 | 2 |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | CWE-639 | 9 |
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 |
$k = trim(strtok($val, ':'));
$v = trim(substr(strstr($val, ':'), 1));
if ($v == '') continue;
$hasdata = true;
if (isset($translate[$k])) {
$k = $translate[$k];
if ($k == '') continue;
if (strstr($k, '.')) {
eval("\$block" . getvarname($k) . "=\$v;");
continue;
}
} else $k = strtolower($k);
if ($k == 'handle') {
$v = strtok($v, ' ');
$gkey = strtoupper($v);
}
if (isset($block[$k]) && is_array($block[$k]))
$block[$k][] = $v;
else
if (!isset($block[$k]) || $block[$k] == '')
$block[$k] = $v;
else {
$x = $block[$k];
unset($block[$k]);
$block[$k][] = $x;
$block[$k][] = $v;
}
} | CWE-94 | 14 |
$masteroption->delete();
}
// delete the mastergroup
$db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id);
$mastergroup->delete();
expHistory::back();
} | CWE-89 | 0 |
private function getDefaultConf(EasyHandle $easy)
{
$conf = [
'_headers' => $easy->request->getHeaders(),
CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(),
CURLOPT_URL => (string) $easy->request->getUri(),
CURLOPT_RETURNTRANSFER => false,
CURLOPT_HEADER => false,
CURLOPT_CONNECTTIMEOUT => 150,
];
if (defined('CURLOPT_PROTOCOLS')) {
$conf[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS;
}
$version = $easy->request->getProtocolVersion();
if ($version == 1.1) {
$conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
} elseif ($version == 2.0) {
$conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0;
} else {
$conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0;
}
return $conf;
} | CWE-89 | 0 |
function list_process($bp,$display,$bdd){
$sql = "select name from bp where is_define = 1 and name!='".$bp."' and priority = '" . $display . "'";
$req = $bdd->query($sql);
$process = $req->fetchall();
echo json_encode($process);
} | CWE-78 | 6 |
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 |
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 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$action = $this->actionModel->getById($this->request->getIntegerParam('action_id'));
if (! empty($action) && $this->actionModel->remove($action['id'])) {
$this->flash->success(t('Action removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this action.'));
}
$this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public function isUsed($id)
{
try {
$select = $this->zdb->select($this->used);
$select->where($this->fpk . ' = ' . $id);
$results = $this->zdb->execute($select);
$result = $results->current();
if ($result !== null) {
return true;
} else {
return false;
}
} catch (Throwable $e) {
Analog::log(
'Unable to check if ' . $this->getType . ' `' . $id .
'` is used. | ' . $e->getMessage(),
Analog::ERROR
);
//in case of error, we consider that it is used, to avoid errors
return true;
}
} | CWE-89 | 0 |
public static function remove_properties($element_type, $element_id, $website_id)
{
global $DB;
global $website;
if(empty($website_id))
$website_id = $website->id;
webdictionary::save_element_strings('property-'.$element_type, $element_id, array());
$DB->execute('
DELETE FROM nv_properties_items
WHERE website = '.$website_id.'
AND element = '.protect($element_type).'
AND node_id = '.intval($element_id).'
');
}
| CWE-89 | 0 |
public function uniqueName($dir, $name, $suffix = ' copy', $checkNum = true, $start = 1) {
$ext = '';
if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) {
$ext = '.'.$m[1];
$name = substr($name, 0, strlen($name)-strlen($m[0]));
}
if ($checkNum && preg_match('/('.preg_quote($suffix, '/').')(\d*)$/i', $name, $m)) {
$i = (int)$m[2];
$name = substr($name, 0, strlen($name)-strlen($m[2]));
} else {
$i = $start;
$name .= $suffix;
}
$max = $i+100000;
while ($i <= $max) {
$n = $name.($i > 0 ? $i : '').$ext;
if (!$this->stat($this->joinPathCE($dir, $n))) {
$this->clearcache();
return $n;
}
$i++;
} | 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 |
static function isSearchable() { return true; }
| CWE-89 | 0 |
public function autocomplete() {
return;
global $db;
$model = $this->params['model'];
$mod = new $model();
$srchcol = explode(",",$this->params['searchoncol']);
/*for ($i=0; $i<count($srchcol); $i++) {
if ($i>=1) $sql .= " OR ";
$sql .= $srchcol[$i].' LIKE \'%'.$this->params['query'].'%\'';
}*/
// $sql .= ' AND parent_id=0';
//eDebug($sql);
//$res = $mod->find('all',$sql,'id',25);
$sql = "select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from ".$db->prefix."product as p INNER JOIN ".$db->prefix."content_expfiles as cef ON p.id=cef.content_id INNER JOIN ".$db->prefix."expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') desc LIMIT 25";
//$res = $db->selectObjectsBySql($sql);
//$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`');
$ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res);
$ar->send();
} | CWE-89 | 0 |
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(""",'"',$str);
$str = str_replace("'","'",$str);
$str = str_replace("’","'",$str);
$str = str_replace("‘","'",$str);
$str = str_replace("®","",$str);
$str = str_replace("�","-", $str);
$str = str_replace("�","-", $str);
$str = str_replace("�", '"', $str);
$str = str_replace("”",'"', $str);
$str = str_replace("�", '"', $str);
$str = str_replace("“",'"', $str);
$str = str_replace("\r\n"," ",$str);
$str = str_replace("�"," 1/4",$str);
$str = str_replace("¼"," 1/4", $str);
$str = str_replace("�"," 1/2",$str);
$str = str_replace("½"," 1/2",$str);
$str = str_replace("�"," 3/4",$str);
$str = str_replace("¾"," 3/4",$str);
$str = str_replace("�", "(TM)", $str);
$str = str_replace("™","(TM)", $str);
$str = str_replace("®","(R)", $str);
$str = str_replace("�","(R)",$str);
$str = str_replace("&","&",$str);
$str = str_replace(">",">",$str);
return trim($str);
} | CWE-89 | 0 |
public function approve_toggle() {
if (empty($this->params['id'])) return;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
$comment = new expComment($this->params['id']);
$comment->approved = $comment->approved == 1 ? 0 : 1;
if ($comment->approved) {
$this->sendApprovalNotification($comment,$this->params);
}
$comment->save();
expHistory::back();
} | CWE-89 | 0 |
private function addServiceInstance($id, Definition $definition, $isSimpleInstance)
{
$class = $this->dumpValue($definition->getClass());
if (0 === strpos($class, "'") && false === strpos($class, '$') && !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) {
throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id));
}
$isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition);
$instantiation = '';
if (!$isProxyCandidate && $definition->isShared()) {
$instantiation = "\$this->services['$id'] = ".($isSimpleInstance ? '' : '$instance');
} elseif (!$isSimpleInstance) { | CWE-89 | 0 |
function send_feedback() {
$success = false;
if (isset($this->params['id'])) {
$ed = new eventdate($this->params['id']);
// $email_addrs = array();
if ($ed->event->feedback_email != '') {
$msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . $this->params['formname'], $this->loc);
$msgtemplate->assign('params', $this->params);
$msgtemplate->assign('event', $ed);
$email_addrs = explode(',', $ed->event->feedback_email);
//This is an easy way to remove duplicates
$email_addrs = array_flip(array_flip($email_addrs));
$email_addrs = array_map('trim', $email_addrs);
$mail = new expMail();
$success += $mail->quickSend(array(
"text_message" => $msgtemplate->render(),
'to' => $email_addrs,
'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS),
'subject' => $this->params['subject'],
));
}
}
if ($success) {
flashAndFlow('message', gt('Your feedback was successfully sent.'));
} else {
flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.'));
}
}
| CWE-89 | 0 |
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'");
}
if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);
// eDebug($sql, true);
// count the unapproved comments
if ($require_approval == 1 && $user->isAdmin()) {
$sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com ';
$sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id ';
$sql .= 'WHERE cnt.content_id='.$this->params['content_id']." AND cnt.content_type='".$this->params['content_type']."' ";
$sql .= 'AND com.approved=0';
$unapproved = $db->countObjectsBySql($sql);
} else {
$unapproved = 0;
}
$this->config = $this->params['config'];
$type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment');
$ratings = !empty($this->params['ratings']) ? true : false;
assign_to_template(array(
'comments'=>$comments,
'config'=>$this->params['config'],
'unapproved'=>$unapproved,
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'user'=>$user,
'hideform'=>$this->params['hideform'],
'hidecomments'=>$this->params['hidecomments'],
'title'=>$this->params['title'],
'formtitle'=>$this->params['formtitle'],
'type'=>$type,
'ratings'=>$ratings,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
));
} | CWE-89 | 0 |
public function testCanGiveCustomReason()
{
$r = new Response(200, [], null, '1.1', 'bar');
$this->assertEquals('bar', $r->getReasonPhrase());
} | CWE-89 | 0 |
public function params()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
$this->create();
return;
}
$action = $this->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | CWE-639 | 9 |
public static function canView($section) {
global $db;
if ($section == null) {
return false;
}
if ($section->public == 0) {
// Not a public section. Check permissions.
return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id));
} else { // Is public. check parents.
if ($section->parent <= 0) {
// Out of parents, and since we are still checking, we haven't hit a private section.
return true;
} else {
$s = $db->selectObject('section', 'id=' . $section->parent);
return self::canView($s);
}
}
}
| CWE-89 | 0 |
Subsets and Splits