code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
private function _new_password($user_id = 0, $password, $token)
{
$auth = Auth::instance();
$user = ORM::factory('user',$user_id);
if ($user->loaded == true)
{
// Determine Method (RiverID or standard)
if (kohana::config('riverid.enable') == TRUE AND ! empty($user->riverid))
{
// Use RiverID
// We don't really have to save the password locally but if a deployer
// ever wants to switch back locally, it's nice to have the pw there
$user->password = $password;
$user->save();
// Relay the password change back to the RiverID server
$riverid = new RiverID;
$riverid->email = $user->email;
$riverid->token = $token;
$riverid->new_password = $password;
if ($riverid->setpassword() == FALSE)
{
// TODO: Something went wrong. Tell the user.
}
}
else
{
// Use Standard
if($auth->hash_password($user->email.$user->last_login, $auth->find_salt($token)) == $token)
{
$user->password = $password;
$user->save();
}
else
{
// TODO: Something went wrong, tell the user.
}
}
return TRUE;
}
// TODO: User doesn't exist, tell the user (meta, I know).
return FALSE;
} | CWE-640 | 20 |
public function actionDeleteDropdown() {
$dropdowns = Dropdowns::model()->findAll();
if (isset($_POST['dropdown'])) {
if ($_POST['dropdown'] != Actions::COLORS_DROPDOWN_ID) {
$model = Dropdowns::model()->findByPk($_POST['dropdown']);
$model->delete();
$this->redirect('manageDropDowns');
}
}
$this->render('deleteDropdowns', array(
'dropdowns' => $dropdowns,
));
} | CWE-79 | 1 |
public static function getTemplateHierarchyFlat($parent, $depth = 1) {
global $db;
$arr = array();
$kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank');
// $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC'));
for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) {
$page = $kids[$i];
$page->depth = $depth;
$page->first = ($i == 0 ? 1 : 0);
$page->last = ($i == count($kids) - 1 ? 1 : 0);
$arr[] = $page;
$arr = array_merge($arr, self::getTemplateHierarchyFlat($page->id, $depth + 1));
}
return $arr;
}
| CWE-89 | 0 |
$section = new section(intval($page));
if ($section) {
// self::deleteLevel($section->id);
$section->delete();
}
}
}
| CWE-89 | 0 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-22 | 2 |
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 remove()
{
$id = (int)$this->id;
try {
$delete = $this->zdb->delete(self::TABLE);
$delete->where(
self::PK . ' = ' . $id
);
$this->zdb->execute($delete);
Analog::log(
'Saved search #' . $id . ' (' . $this->name
. ') deleted successfully.',
Analog::INFO
);
return true;
} catch (\RuntimeException $re) {
throw $re;
} catch (Throwable $e) {
Analog::log(
'Unable to delete saved search ' . $id . ' | ' . $e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
private function flatten(iterable $array, array &$result, string $keySeparator, string $parentKey = '', bool $escapeFormulas = false)
{
foreach ($array as $key => $value) {
if (is_iterable($value)) {
$this->flatten($value, $result, $keySeparator, $parentKey.$key.$keySeparator, $escapeFormulas);
} else {
if ($escapeFormulas && \in_array(substr((string) $value, 0, 1), $this->formulasStartCharacters, true)) {
$result[$parentKey.$key] = "\t".$value;
} else {
// Ensures an actual value is used when dealing with true and false
$result[$parentKey.$key] = false === $value ? 0 : (true === $value ? 1 : $value);
}
}
}
} | CWE-1236 | 12 |
public function testPathMustBeValid()
{
(new Uri(''))->withPath([]);
} | CWE-89 | 0 |
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 |
$loc = expCore::makeLocation('navigation', '', $standalone->id);
if (expPermissions::check('manage', $loc)) return true;
}
return false;
}
| CWE-89 | 0 |
public function remove()
{
$id = (int)$this->id;
if ($this->isSystemType()) {
throw new \RuntimeException(_T("You cannot delete system payment types!"));
}
try {
$delete = $this->zdb->delete(self::TABLE);
$delete->where(
self::PK . ' = ' . $id
);
$this->zdb->execute($delete);
$this->deleteTranslation($this->name);
Analog::log(
'Payment type #' . $id . ' (' . $this->name
. ') deleted successfully.',
Analog::INFO
);
return true;
} catch (Throwable $e) {
Analog::log(
'Unable to delete payment type ' . $id . ' | ' . $e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
static function displayname() {
return gt("e-Commerce Category Manager");
} | CWE-89 | 0 |
private function edebug($str) {
if ($this->Debugoutput == "error_log") {
error_log($str);
} else {
echo $str;
}
} | CWE-79 | 1 |
public function __construct() {
}
| 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 |
protected function getComment()
{
$comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id'));
if (empty($comment)) {
throw new PageNotFoundException();
}
if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) {
throw new AccessForbiddenException();
}
return $comment;
} | CWE-639 | 9 |
private function resize_gd($src, $width, $height, $quality, $srcImgInfo) {
switch ($srcImgInfo['mime']) {
case 'image/gif':
if (@imagetypes() & IMG_GIF) {
$oSrcImg = @imagecreatefromgif($src);
} else {
$ermsg = 'GIF images are not supported';
}
break;
case 'image/jpeg':
if (@imagetypes() & IMG_JPG) {
$oSrcImg = @imagecreatefromjpeg($src) ;
} else {
$ermsg = 'JPEG images are not supported';
}
break;
case 'image/png':
if (@imagetypes() & IMG_PNG) {
$oSrcImg = @imagecreatefrompng($src) ;
} else {
$ermsg = 'PNG images are not supported';
}
break;
case 'image/wbmp':
if (@imagetypes() & IMG_WBMP) {
$oSrcImg = @imagecreatefromwbmp($src);
} else {
$ermsg = 'WBMP images are not supported';
}
break;
default:
$oSrcImg = false;
$ermsg = $srcImgInfo['mime'].' images are not supported';
break;
}
if ($oSrcImg && false != ($tmp = imagecreatetruecolor($width, $height))) {
if (!imagecopyresampled($tmp, $oSrcImg, 0, 0, 0, 0, $width, $height, $srcImgInfo[0], $srcImgInfo[1])) {
return false;
}
switch ($srcImgInfo['mime']) {
case 'image/gif':
imagegif($tmp, $src);
break;
case 'image/jpeg':
imagejpeg($tmp, $src, $quality);
break;
case 'image/png':
if (function_exists('imagesavealpha') && function_exists('imagealphablending')) {
imagealphablending($tmp, false);
imagesavealpha($tmp, true);
}
imagepng($tmp, $src);
break;
case 'image/wbmp':
imagewbmp($tmp, $src);
break;
}
imagedestroy($oSrcImg);
imagedestroy($tmp);
return true;
}
return false;
} | CWE-89 | 0 |
function db_start()
{
global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;
switch ($DatabaseType) {
case 'mysqli':
$connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);
break;
}
// Error code for both.
if ($connection === false) {
switch ($DatabaseType) {
case 'mysqli':
$errormessage = mysqli_error($connection);
break;
}
db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errormessage);
}
return $connection;
} | CWE-79 | 1 |
public function Login ($username = '', $password = '') {
if ($this->connected == false) {
$this->error = 'Not connected to POP3 server';
if ($this->do_debug >= 1) {
$this->displayErrors();
}
}
if (empty($username)) {
$username = $this->username;
}
if (empty($password)) {
$password = $this->password;
}
$pop_username = "USER $username" . $this->CRLF;
$pop_password = "PASS $password" . $this->CRLF;
// Send the Username
$this->sendString($pop_username);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
// Send the Password
$this->sendString($pop_password);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
return true;
}
}
return false;
} | CWE-79 | 1 |
public function __construct() {
self::map();
}
| CWE-89 | 0 |
$db->updateObject($value, 'section');
}
$db->updateObject($moveSec, 'section');
//handle re-ranking of previous parent
$oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank");
$rerank = 1;
foreach ($oldSiblings as $value) {
if ($value->id != $moveSec->id) {
$value->rank = $rerank;
$db->updateObject($value, 'section');
$rerank++;
}
}
if ($oldParent != $moveSec->parent) {
//we need to re-rank the children of the parent that the moving section has just left
$childOfLastMove = $db->selectObjects("section", "parent=" . $oldParent . " ORDER BY rank");
for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) {
$childOfLastMove[$i]->rank = $i;
$db->updateObject($childOfLastMove[$i], 'section');
}
}
}
}
self::checkForSectionalAdmins($move);
expSession::clearAllUsersSessionCache('navigation');
}
| CWE-89 | 0 |
function draw_cdef_preview($cdef_id) {
?>
<tr class='even'>
<td style='padding:4px'>
<pre>cdef=<?php print get_cdef($cdef_id, true);?></pre>
</td>
</tr>
<?php
} | CWE-79 | 1 |
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 |
function edit_option_master() {
expHistory::set('editable', $this->params);
$params = isset($this->params['id']) ? $this->params['id'] : $this->params;
$record = new option_master($params);
assign_to_template(array(
'record'=>$record
));
} | CWE-89 | 0 |
public static function navtojson() {
return json_encode(self::navhierarchy());
}
| CWE-89 | 0 |
public static function addViews($id) {
$botlist = self::botlist();
$nom = 0;
foreach($botlist as $bot) {
if(preg_match("/{$bot}/", $_SERVER['HTTP_USER_AGENT'])) {
$nom = 1+$nom;
}else{
$nom = 0;
}
}
if ($nom == 0) {
# code...
$sql = "UPDATE `posts` SET `views` = `views`+1 WHERE `id` = '{$id}' LIMIT 1";
$q = Db::query($sql);
}
}
| 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-79 | 1 |
public function start()
{
@session_start();
$this->started = session_id()? true : false;
return $this;
} | CWE-89 | 0 |
function showByModel() {
global $order, $template, $db;
expHistory::set('viewable', $this->params);
$product = new product();
$model = $product->find("first", 'model="' . $this->params['model'] . '"');
//eDebug($model);
$product_type = new $model->product_type($model->id);
//eDebug($product_type);
$tpl = $product_type->getForm('show');
if (!empty($tpl)) $template = new controllertemplate($this, $tpl);
//eDebug($template);
$this->grabConfig(); // grab the global config
assign_to_template(array(
'config' => $this->config,
'product' => $product_type,
'last_category' => $order->lastcat
));
} | CWE-89 | 0 |
public function getSection() {
global $db;
if (expTheme::inAction()) {
if (isset($_REQUEST['section'])) {
$section = $this->url_style=="sef" ? $this->getPageByName($_REQUEST['section'])->id : intval($_REQUEST['section']) ;
} else {
$section = (expSession::is_set('last_section') ? expSession::get('last_section') : SITE_DEFAULT_SECTION);
}
} else {
$section = (isset($_REQUEST['section']) ? intval($_REQUEST['section']) : SITE_DEFAULT_SECTION);
}
$testsection = $db->selectObject('section','id='.$section);
if (empty($testsection)) {
$section = SITE_DEFAULT_SECTION;
}
return $section;
} | CWE-89 | 0 |
public function onRouteStartup(Enlight_Controller_EventArgs $args)
{
$request = $args->getRequest();
if (strpos($request->getPathInfo(), '/backend') === 0
|| strpos($request->getPathInfo(), '/api/') === 0
) {
return;
}
$shop = $this->getShopByRequest($request);
if (!$shop->getHost()) {
$shop->setHost($request->getHttpHost());
}
if (!$shop->getBaseUrl()) {
$preferBasePath = $this->get(Shopware_Components_Config::class)->preferBasePath;
$shop->setBaseUrl($preferBasePath ? $request->getBasePath() : $request->getBaseUrl());
}
if (!$shop->getBasePath()) {
$shop->setBasePath($request->getBasePath());
}
// Read original base path for resources
$request->getBasePath();
$request->setBaseUrl($shop->getBaseUrl());
// Update path info
$request->setPathInfo(
$this->createPathInfo($request, $shop)
);
if (($host = $request->getHeader('X_FORWARDED_HOST')) !== null
&& $host === $shop->getHost()
) {
// If the base path is null, set it to empty string. Otherwise the request will try to assemble the base path. On a reverse proxy setup with varnish this will fail on virtual URLs like /en
// The X-Forwarded-Host header is only set in such environments
if ($shop->getBasePath() === null) {
$shop->setBasePath('');
}
$request->setSecure();
$request->setBasePath($shop->getBasePath());
$request->setBaseUrl($shop->getBaseUrl());
$request->setHttpHost($shop->getHost());
}
$this->validateShop($shop);
$this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);
} | CWE-601 | 11 |
public function save()
{
global $DB;
if(!empty($this->id))
return $this->update();
else
return $this->insert();
}
| CWE-79 | 1 |
public static function getModelTypes($assoc = false) {
$modelTypes = Yii::app()->db->createCommand()
->selectDistinct('modelName')
->from('x2_fields')
->where('modelName!="Calendar"')
->order('modelName ASC')
->queryColumn();
if ($assoc === true) {
return array_combine($modelTypes, array_map(function($term) {
return Yii::t('app', X2Model::getModelTitle($term));
}, $modelTypes));
}
$modelTypes = array_map(function($term) {
return Yii::t('app', $term);
}, $modelTypes);
return $modelTypes;
} | CWE-79 | 1 |
public static function isExist($user)
{
if (isset($_GET['act']) && $_GET['act'] == 'edit') {
$id = Typo::int($_GET['id']);
$where = "AND `id` != '{$id}' ";
} else {
$where = '';
}
$user = sprintf('%s', Typo::cleanX($user));
$sql = sprintf("SELECT `userid` FROM `user` WHERE `userid` = '%s' %s ", $user, $where);
$usr = Db::result($sql);
$n = Db::$num_rows;
if ($n > 0) {
return false;
} else {
return true;
}
} | CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask/remove', array(
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
public static function dropdown($vars) {
if(is_array($vars)){
//print_r($vars);
$name = $vars['name'];
$where = "WHERE ";
if(isset($vars['parent'])) {
$where .= " `parent` = '{$vars['parent']}' ";
}else{
$where .= "1 ";
}
$order_by = "ORDER BY ";
if(isset($vars['order_by'])) {
$order_by .= " {$vars['order_by']} ";
}else{
$order_by .= " `name` ";
}
if (isset($vars['sort'])) {
$sort = " {$vars['sort']}";
}
}
$cat = Db::result("SELECT * FROM `cat` {$where} {$order_by} {$sort}");
$drop = "<select name=\"{$name}\" class=\"form-control\"><option></option>";
if(Db::$num_rows > 0 ){
foreach ($cat as $c) {
# code...
if($c->parent == ''){
if(isset($vars['selected']) && $c->id == $vars['selected']) $sel = "SELECTED"; else $sel = "";
$drop .= "<option value=\"{$c->id}\" $sel style=\"padding-left: 10px;\">{$c->name}</option>";
foreach ($cat as $c2) {
# code...
if($c2->parent == $c->id){
if(isset($vars['selected']) && $c2->id == $vars['selected']) $sel = "SELECTED"; else $sel = "";
$drop .= "<option value=\"{$c2->id}\" $sel style=\"padding-left: 10px;\"> {$c2->name}</option>";
}
}
}
}
}
$drop .= "</select>";
return $drop;
} | CWE-79 | 1 |
public static function navtojson() {
return json_encode(self::navhierarchy());
}
| CWE-89 | 0 |
$body = str_replace(array("\n"), "<br />", $body);
} else {
// It's going elsewhere (doesn't like quoted-printable)
$body = str_replace(array("\n"), " -- ", $body);
}
$title = $items[$i]->title;
$msg .= "BEGIN:VEVENT\n";
$msg .= $dtstart . $dtend;
$msg .= "UID:" . $items[$i]->date_id . "\n";
$msg .= "DTSTAMP:" . date("Ymd\THis", time()) . "Z\n";
if ($title) {
$msg .= "SUMMARY:$title\n";
}
if ($body) {
$msg .= "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" . $body . "\n";
}
// if($link_url) { $msg .= "URL: $link_url\n";}
if (!empty($this->config['usecategories'])) {
if (!empty($items[$i]->expCat[0]->title)) {
$msg .= "CATEGORIES:".$items[$i]->expCat[0]->title."\n";
} else {
$msg .= "CATEGORIES:".$this->config['uncat']."\n";
}
}
$msg .= "END:VEVENT\n";
}
| CWE-89 | 0 |
public static function find($code)
{
global $DB;
global $website;
$DB->query('
SELECT *
FROM nv_coupons
WHERE website = '.protect($website->id).' AND
code = '.protect($code),
'object'
);
$rs = $DB->result();
$out = false;
if(!empty($rs))
{
$coupon = new coupon();
$coupon->load_from_resultset($rs);
$out = $coupon;
}
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 |
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));
$ret .= scan_container($cLoc, $page->id);
$ret .= scan_page($page->id);
}
| CWE-89 | 0 |
public function get($key, $default = null, $deep = false)
{
if ($deep) {
@trigger_error('Using paths to find deeper items in '.__METHOD__.' is deprecated since version 2.8 and will be removed in 3.0. Filter the returned value in your own code instead.', E_USER_DEPRECATED);
}
if ($this !== $result = $this->query->get($key, $this, $deep)) {
return $result;
}
if ($this !== $result = $this->attributes->get($key, $this, $deep)) {
return $result;
}
if ($this !== $result = $this->request->get($key, $this, $deep)) {
return $result;
}
return $default;
} | CWE-89 | 0 |
$files[$i] = '.' . DIRECTORY_SEPARATOR . basename($file);
}
$files = array_map('escapeshellarg', $files);
$cmd = $arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . implode(' ', $files);
$err_out = '';
$this->procExec($cmd, $o, $c, $err_out, $dir);
chdir($cwd);
} else {
return false;
}
}
$path = $dir . DIRECTORY_SEPARATOR . $name;
return file_exists($path) ? $path : false;
} | CWE-918 | 16 |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| CWE-89 | 0 |
function _real_escape( $string ) {
if ( $this->dbh ) {
if ( $this->use_mysqli ) {
return mysqli_real_escape_string( $this->dbh, $string );
} else {
return mysql_real_escape_string( $string, $this->dbh );
}
}
$class = get_class( $this );
if ( function_exists( '__' ) ) {
/* translators: %s: database access abstraction class, usually wpdb or a class extending wpdb */
_doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), '3.6.0' );
} else {
_doing_it_wrong( $class, sprintf( '%s must set a database connection for use with escaping.', $class ), '3.6.0' );
}
return addslashes( $string );
} | CWE-89 | 0 |
form_end_row();
$i++;
}
html_end_box(false);
/*
print "<pre>";
if (isset($check) && is_array($check)) {
print_r($check);
}
print "</pre>";
*/
} | CWE-79 | 1 |
form_selectable_cell('<a class="linkEditMain" href="' . html_escape('automation_networks.php?action=edit&id=' . $network['id']) . '">' . $network['name'] . '</a>', $network['id']);
form_selectable_cell($network['data_collector'], $network['id']);
form_selectable_cell($sched_types[$network['sched_type']], $network['id']);
form_selectable_cell(number_format_i18n($network['total_ips']), $network['id'], '', 'text-align:right;');
form_selectable_cell($mystat, $network['id'], '', 'text-align:right;');
form_selectable_cell($progress, $network['id'], '', 'text-align:right;');
form_selectable_cell(number_format_i18n($updown['up']) . '/' . number_format_i18n($updown['snmp']), $network['id'], '', 'text-align:right;');
form_selectable_cell(number_format_i18n($network['threads']), $network['id'], '', 'text-align:right;');
form_selectable_cell(round($network['last_runtime'],2), $network['id'], '', 'text-align:right;');
form_selectable_cell($network['enabled'] == '' || $network['sched_type'] == '1' ? __('N/A'):($network['next_start'] == '0000-00-00 00:00:00' ? substr($network['start_at'],0,16):substr($network['next_start'],0,16)), $network['id'], '', 'text-align:right;');
form_selectable_cell($network['last_started'] == '0000-00-00 00:00:00' ? 'Never':substr($network['last_started'],0,16), $network['id'], '', 'text-align:right;');
form_checkbox_cell($network['name'], $network['id']);
form_end_row();
}
} else { | CWE-79 | 1 |
function update_upcharge() {
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
//This will make sure that only the country or region that given a rate value will be saved in the db
$upcharge = array();
foreach($this->params['upcharge'] as $key => $item) {
if(!empty($item)) {
$upcharge[$key] = $item;
}
}
$this->config['upcharge'] = $upcharge;
$config->update(array('config'=>$this->config));
flash('message', gt('Configuration updated'));
expHistory::back();
} | CWE-89 | 0 |
function __construct($apikey){
$this->apikey = $apikey;
$this->config = $this->getConfig($apikey);
//echo $this->apikey;
}
| CWE-89 | 0 |
public function search_external() {
// global $db, $user;
global $db;
$sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email ";
$sql .= "from " . $db->prefix . "external_addresses as a "; //R JOIN " .
//$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id ";
$sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] .
"*' IN BOOLEAN MODE) ";
$sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) ASC LIMIT 12";
$res = $db->selectObjectsBySql($sql);
foreach ($res as $key=>$record) {
$res[$key]->title = $record->firstname . ' ' . $record->lastname;
}
//eDebug($sql);
$ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res);
$ar->send();
} | CWE-89 | 0 |
function _download_header($filename, $filesize = 0)
{
$browser=id_browser();
header('Content-Type: '.(($browser=='IE' || $browser=='OPERA')?
'application/octetstream':'application/octet-stream')); | CWE-22 | 2 |
public function getSupportedBrands()
{
return array(
static::BRAND_VISA => '/^4\d{12}(\d{3})?$/',
static::BRAND_MASTERCARD => '/^(5[1-5]\d{4}|677189)\d{10}$/',
static::BRAND_DISCOVER => '/^(6011|65\d{2}|64[4-9]\d)\d{12}|(62\d{14})$/',
static::BRAND_AMEX => '/^3[47]\d{13}$/',
static::BRAND_DINERS_CLUB => '/^3(0[0-5]|[68]\d)\d{11}$/',
static::BRAND_JCB => '/^35(28|29|[3-8]\d)\d{12}$/',
static::BRAND_SWITCH => '/^6759\d{12}(\d{2,3})?$/',
static::BRAND_SOLO => '/^6767\d{12}(\d{2,3})?$/',
static::BRAND_DANKORT => '/^5019\d{12}$/',
static::BRAND_MAESTRO => '/^(5[06-8]|6\d)\d{10,17}$/',
static::BRAND_FORBRUGSFORENINGEN => '/^600722\d{10}$/',
static::BRAND_LASER => '/^(6304|6706|6709|6771(?!89))\d{8}(\d{4}|\d{6,7})?$/',
);
} | CWE-89 | 0 |
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 |
public static function is_loggedin () {
$username = Session::val('username');
if(isset($username)) {
$v = true;
}else{
$v = false;
}
return $v;
}
| CWE-89 | 0 |
public function remove()
{
$project = $this->getProject();
$this->checkCSRFParam();
$column_id = $this->request->getIntegerParam('column_id');
if ($this->columnModel->remove($column_id)) {
$this->flash->success(t('Column removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this column.'));
}
$this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public static function add($var) {
$route = self::$_route;
self::$_route = array_merge($route, $var);
return self::$_route;
}
| CWE-89 | 0 |
function selectArraysBySql($sql) {
$res = @mysqli_query($this->connection, $this->injectProof($sql));
if ($res == null)
return array();
$arrays = array();
for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)
$arrays[] = mysqli_fetch_assoc($res);
return $arrays;
} | CWE-89 | 0 |
protected function getTestServiceSubscriberService()
{
return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber();
} | CWE-89 | 0 |
public function confirm()
{
$project = $this->getProject();
$swimlane = $this->getSwimlane();
$this->response->html($this->helper->layout->project('swimlane/remove', array(
'project' => $project,
'swimlane' => $swimlane,
)));
} | CWE-639 | 9 |
public function clean()
{
$dataSourceConfig = ConnectionManager::getDataSource('default')->config;
$dataSource = $dataSourceConfig['datasource'];
if ($dataSource == 'Database/Mysql') {
$sql = 'DELETE FROM bruteforces WHERE `expire` <= NOW();';
} elseif ($dataSource == 'Database/Postgres') {
$sql = 'DELETE FROM bruteforces WHERE expire <= NOW();';
}
$this->query($sql);
} | CWE-367 | 29 |
public function AddAddress($address, $name = '') {
return $this->AddAnAddress('to', $address, $name);
} | CWE-79 | 1 |
public function toolbar() {
// global $user;
$menu = array();
$dirs = array(
BASE.'framework/modules/administration/menus',
BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus'
);
foreach ($dirs as $dir) {
if (is_readable($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {
$menu[substr($file,0,-4)] = include($dir.'/'.$file);
if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]);
}
}
}
}
// sort the top level menus alphabetically by filename
ksort($menu);
$sorted = array();
foreach($menu as $m) $sorted[] = $m;
// slingbar position
if (isset($_COOKIE['slingbar-top'])){
$top = $_COOKIE['slingbar-top'];
} else {
$top = SLINGBAR_TOP;
}
assign_to_template(array(
'menu'=>(bs3()) ? $sorted : json_encode($sorted),
"top"=>$top
));
} | CWE-89 | 0 |
public function display_sdm_upload_meta_box($post) { // File Upload metabox
$old_upload = get_post_meta($post->ID, 'sdm_upload', true);
$old_value = isset($old_upload) ? $old_upload : '';
_e('Manually enter a valid URL of the file in the text box below, or click "Select File" button to upload (or choose) the downloadable file.', 'simple-download-monitor');
echo '<br /><br />';
echo '<div class="sdm-download-edit-file-url-section">';
echo '<input id="sdm_upload" type="text" size="100" name="sdm_upload" value="' . $old_value . '" placeholder="http://..." />';
echo '</div>';
echo '<br />';
echo '<input id="upload_image_button" type="button" class="button-primary" value="' . __('Select File', 'simple-download-monitor') . '" />';
echo '<br /><br />';
_e('Steps to upload a file or choose one from your media library:', 'simple-download-monitor');
echo '<ol>';
echo '<li>Hit the "Select File" button.</li>';
echo '<li>Upload a new file or choose an existing one from your media library.</li>';
echo '<li>Click the "Insert" button, this will populate the uploaded file\'s URL in the above text field.</li>';
echo '</ol>';
wp_nonce_field('sdm_upload_box_nonce', 'sdm_upload_box_nonce_check');
} | CWE-79 | 1 |
public static function getTemplateHierarchyFlat($parent, $depth = 1) {
global $db;
$arr = array();
$kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank');
// $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC'));
for ($i = 0, $iMax = count($kids); $i < $iMax; $i++) {
$page = $kids[$i];
$page->depth = $depth;
$page->first = ($i == 0 ? 1 : 0);
$page->last = ($i == count($kids) - 1 ? 1 : 0);
$arr[] = $page;
$arr = array_merge($arr, self::getTemplateHierarchyFlat($page->id, $depth + 1));
}
return $arr;
}
| CWE-89 | 0 |
public function run()
{
if ($this->user->isCurrentUser() || \Yii::$app->user->isGuest) {
return;
}
// Add class for javascript handling
$this->followOptions['class'] .= ' followButton';
$this->unfollowOptions['class'] .= ' unfollowButton';
// Hide inactive button
if ($this->user->isFollowedByUser()) {
$this->followOptions['style'] .= ' display:none;';
} else {
$this->unfollowOptions['style'] .= ' display:none;';
}
// Add UserId Buttons
$this->followOptions['data-content-container-id'] = $this->user->id;
$this->unfollowOptions['data-content-container-id'] = $this->user->id;
// Add JS Action
$this->followOptions['data-action-click'] = 'content.container.follow';
$this->unfollowOptions['data-action-click'] = 'content.container.unfollow';
// Add Action Url
$this->followOptions['data-action-url'] = $this->user->createUrl('/user/profile/follow');
$this->unfollowOptions['data-action-url'] = $this->user->createUrl('/user/profile/unfollow');
// Add Action Url
$this->followOptions['data-ui-loader'] = '';
$this->unfollowOptions['data-ui-loader'] = '';
// Confirm action "Unfollow"
$this->unfollowOptions['data-action-confirm'] = Yii::t('SpaceModule.base', 'Would you like to unfollow {userName}?', [
'{userName}' => '<strong>' . $this->user->getDisplayName() . '</strong>'
]);
$module = Yii::$app->getModule('user');
// still enable unfollow if following was disabled afterwards.
if ($module->disableFollow) {
return Html::a($this->unfollowLabel, '#', $this->unfollowOptions);
}
return Html::a($this->unfollowLabel, '#', $this->unfollowOptions) .
Html::a($this->followLabel, '#', $this->followOptions);
} | CWE-79 | 1 |
public static function format($date, $format='') {
$timezone = Options::v('timezone');
$time = strtotime($date);
(empty($format))? $format = "j F Y H:i A T" : $format = $format;
$date = new DateTime($date);
$date->setTimezone(new DateTimeZone($timezone));
$newdate = $date->format($format);
return $newdate;
}
| CWE-89 | 0 |
public function __construct($mongo, array $options)
{
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
throw new \InvalidArgumentException('MongoClient or Mongo instance required');
}
if (!isset($options['database']) || !isset($options['collection'])) {
throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler');
}
$this->mongo = $mongo;
$this->options = array_merge(array(
'id_field' => '_id',
'data_field' => 'data',
'time_field' => 'time',
'expiry_field' => 'expires_at',
), $options);
} | CWE-89 | 0 |
$contents = ['form' => tep_draw_form('countries', 'countries.php', 'page=' . $_GET['page'] . '&action=insert')]; | CWE-79 | 1 |
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 matchesPath($requestPath)
{
$cookiePath = $this->getPath();
// Match on exact matches or when path is the default empty "/"
if ($cookiePath == '/' || $cookiePath == $requestPath) {
return true;
}
// Ensure that the cookie-path is a prefix of the request path.
if (0 !== strpos($requestPath, $cookiePath)) {
return false;
}
// Match if the last character of the cookie-path is "/"
if (substr($cookiePath, -1, 1) == '/') {
return true;
}
// Match if the first character not included in cookie path is "/"
return substr($requestPath, strlen($cookiePath), 1) == '/';
} | CWE-89 | 0 |
function db_properties($table)
{
global $DatabaseType, $DatabaseUsername;
switch ($DatabaseType) {
case 'mysqli':
$result = DBQuery("SHOW COLUMNS FROM $table");
while ($row = db_fetch_row($result)) {
$properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));
if (!$pos = strpos($row['TYPE'], ','))
$pos = strpos($row['TYPE'], ')');
else
$properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);
$properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);
if ($row['NULL'] != '')
$properties[strtoupper($row['FIELD'])]['NULL'] = "Y";
else
$properties[strtoupper($row['FIELD'])]['NULL'] = "N";
}
break;
}
return $properties;
} | CWE-22 | 2 |
public function showall() {
expHistory::set('viewable', $this->params);
// figure out if should limit the results
if (isset($this->params['limit'])) {
$limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];
} else {
$limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;
}
$order = isset($this->config['order']) ? $this->config['order'] : 'publish DESC';
// pull the news posts from the database
$items = $this->news->find('all', $this->aggregateWhereClause(), $order);
// merge in any RSS news and perform the sort and limit the number of posts we return to the configured amount.
if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items);
// setup the pagination object to paginate the news stories.
$page = new expPaginator(array(
'records'=>$items,
'limit'=>$limit,
'order'=>$order,
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'view'=>empty($this->params['view']) ? null : $this->params['view']
));
assign_to_template(array(
'page'=>$page,
'items'=>$page->records,
'rank'=>($order==='rank')?1:0,
'params'=>$this->params,
));
} | CWE-89 | 0 |
public function save()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) {
if ($this->categoryModel->create($values) !== false) {
$this->flash->success(t('Your category have been created successfully.'));
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);
return;
} else {
$errors = array('name' => array(t('Another category with the same name exists in this project')));
}
}
$this->create($values, $errors);
} | CWE-639 | 9 |
public function __construct() {
}
| CWE-89 | 0 |
function update_option_master() {
global $db;
$id = empty($this->params['id']) ? null : $this->params['id'];
$opt = new option_master($id);
$oldtitle = $opt->title;
$opt->update($this->params);
// if the title of the master changed we should update the option groups that are already using it.
if ($oldtitle != $opt->title) {
}$db->sql('UPDATE '.$db->prefix.'option SET title="'.$opt->title.'" WHERE option_master_id='.$opt->id);
expHistory::back();
} | CWE-89 | 0 |
public function __construct($uri = '')
{
if ($uri != null) {
$parts = parse_url($uri);
if ($parts === false) {
throw new \InvalidArgumentException("Unable to parse URI: $uri");
}
$this->applyParts($parts);
}
} | CWE-89 | 0 |
public function updateFile(Attachment $attachment, $requestData)
{
$attachment->name = $requestData['name'];
if (isset($requestData['link']) && trim($requestData['link']) !== '') {
$attachment->path = $requestData['link'];
if (!$attachment->external) {
$this->deleteFileInStorage($attachment);
$attachment->external = true;
}
}
$attachment->save();
return $attachment;
} | 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 |
public function update() {
//populate the alt tag field if the user didn't
if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title'];
// call expController update to save the image
parent::update();
} | CWE-89 | 0 |
private function _includeFiles($files)
{
$dynamic_scripts = "";
$scripts = array();
foreach ($files as $value) {
if (strpos($value['filename'], "?") !== false) {
$dynamic_scripts .= "<script type='text/javascript' src='js/"
. $value['filename'] . "'></script>";
continue;
}
$include = true;
if ($value['conditional_ie'] !== false
&& PMA_USR_BROWSER_AGENT === 'IE'
) {
if ($value['conditional_ie'] === true) {
$include = true;
} else if ($value['conditional_ie'] == PMA_USR_BROWSER_VER) {
$include = true;
} else {
$include = false;
}
}
if ($include) {
$scripts[] = "scripts[]=" . $value['filename'];
}
}
$separator = PMA_URL_getArgSeparator();
$url = 'js/get_scripts.js.php'
. PMA_URL_getCommon(array(), 'none')
. $separator . implode($separator, $scripts);
$static_scripts = sprintf(
'<script type="text/javascript" src="%s"></script>',
htmlspecialchars($url)
);
return $static_scripts . $dynamic_scripts;
} | CWE-79 | 1 |
function realCharForNumericEntities($matches)
{
$newstringnumentity = $matches[1];
if (preg_match('/^x/i', $newstringnumentity)) {
$newstringnumentity = hexdec(preg_replace('/^x/i', '', $newstringnumentity));
}
// The numeric value we don't want as entities
if (($newstringnumentity >= 65 && $newstringnumentity <= 90) || ($newstringnumentity >= 97 && $newstringnumentity <= 122)) {
return chr((int) $newstringnumentity);
}
return '&#'.$matches[1];
} | CWE-79 | 1 |
public function saveUpdatedUpload(UploadedFile $uploadedFile, Attachment $attachment)
{
if (!$attachment->external) {
$this->deleteFileInStorage($attachment);
}
$attachmentName = $uploadedFile->getClientOriginalName();
$attachmentPath = $this->putFileInStorage($uploadedFile);
$attachment->name = $attachmentName;
$attachment->path = $attachmentPath;
$attachment->external = false;
$attachment->extension = $uploadedFile->getClientOriginalExtension();
$attachment->save();
return $attachment;
} | CWE-22 | 2 |
function move_standalone() {
expSession::clearAllUsersSessionCache('navigation');
assign_to_template(array(
'parent' => $this->params['parent'],
));
}
| CWE-89 | 0 |
public function store()
{
$data = array(
'type_name' => $this->name
);
try {
if ($this->id !== null && $this->id > 0) {
if ($this->old_name !== null) {
$this->deleteTranslation($this->old_name);
$this->addTranslation($this->name);
}
$update = $this->zdb->update(self::TABLE);
$update->set($data)->where(
self::PK . '=' . $this->id
);
$this->zdb->execute($update);
} else {
$insert = $this->zdb->insert(self::TABLE);
$insert->values($data);
$add = $this->zdb->execute($insert);
if (!$add->count() > 0) {
Analog::log('Not stored!', Analog::ERROR);
return false;
}
$this->id = $this->zdb->getLastGeneratedValue($this);
$this->addTranslation($this->name);
}
return true;
} catch (Throwable $e) {
Analog::log(
'An error occurred storing payment type: ' . $e->getMessage() .
"\n" . print_r($data, true),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
public static function initializeNavigation() {
$sections = section::levelTemplate(0, 0);
return $sections;
}
| CWE-89 | 0 |
public static function publish($id) {
$id = Typo::int($id);
$ins = array(
'table' => 'posts',
'id' => $id,
'key' => array(
'status' => '1'
)
);
$post = Db::update($ins);
return $post;
}
| CWE-89 | 0 |
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {
if ($is_revisioned) {
$object->revision_id++;
//if ($table=="text") eDebug($object);
$res = $this->insertObject($object, $table);
//if ($table=="text") eDebug($object,true);
$this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);
return $res;
}
$sql = "UPDATE " . $this->prefix . "$table SET ";
foreach (get_object_vars($object) as $var => $val) {
//We do not want to save any fields that start with an '_'
//if($is_revisioned && $var=='revision_id') $val++;
if ($var{0} != '_') {
if (is_array($val) || is_object($val)) {
$val = serialize($val);
$sql .= "`$var`='".$val."',";
} else {
$sql .= "`$var`='".mysqli_real_escape_string($this->connection,$val)."',";
}
}
}
$sql = substr($sql, 0, -1) . " WHERE ";
if ($where != null)
$sql .= $where;
else
$sql .= "`" . $identifier . "`=" . $object->$identifier;
//if ($table == 'text') eDebug($sql,true);
$res = (@mysqli_query($this->connection, $sql) != false);
return $res;
} | CWE-89 | 0 |
protected function defaultExtensions()
{
return [
'jpg',
'jpeg',
'bmp',
'png',
'webp',
'gif',
'svg',
'js',
'map',
'ico',
'css',
'less',
'scss',
'ics',
'odt',
'doc',
'docx',
'ppt',
'pptx',
'pdf',
'swf',
'txt',
'xml',
'ods',
'xls',
'xlsx',
'eot',
'woff',
'woff2',
'ttf',
'flv',
'wmv',
'mp3',
'ogg',
'wav',
'avi',
'mov',
'mp4',
'mpeg',
'webm',
'mkv',
'rar',
'xml',
'zip'
];
} | CWE-79 | 1 |
public static function recent($vars) {
$catW = isset($vars['cat'])? " AND `cat` = '".$vars['cat']:"";
$type = isset($vars['type'])? $vars['type']: "post";
$num = isset($vars['num'])? $vars['num']: "10";
$sql = "SELECT * FROM `posts`
WHERE `type` = '{$type}' $catW AND `status` = '1'
ORDER BY `date` DESC LIMIT {$num}";
$posts = Db::result($sql);
if(isset($posts['error'])){
$posts['error'] = "No Posts found.";
}else{
$posts = self::prepare($posts);
}
return $posts;
}
| CWE-89 | 0 |
public function testGetRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId)
{
$request = new Enlight_Controller_Request_RequestTestCase();
$request->setMethod('GET');
$response = new Enlight_Controller_Response_ResponseTestCase();
$request->setPathInfo($uri);
$this->router->assembleRoute($request, $response);
static::assertEquals($expectedController, $request->getControllerName());
static::assertEquals($expectedAction, $request->getActionName());
static::assertEquals($expectedVersion, $request->getParam('version'));
static::assertEquals($expectedId, $request->getParam('id'));
static::assertEquals(200, $response->getHttpResponseCode());
} | CWE-601 | 11 |
public function getQueryGroupby()
{
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return "$R2.id";
} | CWE-89 | 0 |
public static function optionsExist($var) {
if (file_exists(GX_THEME.$var.'/options.php')) {
return true;
}else{
return false;
}
}
| CWE-89 | 0 |
public function saveconfig() {
global $db;
if (empty($this->params['id'])) return false;
$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);
$calc = new $calcname($this->params['id']);
$conf = serialize($calc->parseConfig($this->params));
$calc->update(array('config'=>$conf));
expHistory::back();
} | CWE-89 | 0 |
public function confirm()
{
$project = $this->getProject();
$this->response->html($this->helper->layout->project('column/remove', array(
'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')),
'project' => $project,
)));
} | CWE-639 | 9 |
$contents = ['form' => tep_draw_form('testimonials', 'testimonials.php', 'page=' . $_GET['page'] . '&tID=' . $tInfo->testimonials_id . '&action=deleteconfirm')]; | CWE-79 | 1 |
$sloc = expCore::makeLocation('navigation', null, $section->id);
// remove any manage permissions for this page and it's children
// $db->delete('userpermission', "module='navigationController' AND internal=".$section->id);
// $db->delete('grouppermission', "module='navigationController' AND internal=".$section->id);
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
}
}
| CWE-89 | 0 |
function advancedFilterSearch($queue, $filter)
{
global $database_ged;
$datas = array();
if($filter == "description"){
echo json_encode($datas);
return false;
}
$gedsql_result1=sqlrequest($database_ged,"SELECT pkt_type_id,pkt_type_name FROM pkt_type WHERE pkt_type_id!='0' AND pkt_type_id<'100';");
while($ged_type = mysqli_fetch_assoc($gedsql_result1)){
$sql = "SELECT DISTINCT $filter FROM ".$ged_type["pkt_type_name"]."_queue_".$queue;
$results = sqlrequest($database_ged, $sql);
while($result = mysqli_fetch_array($results)){
if( !in_array($result[$filter], $datas) && $result[$filter] != "" ){
array_push($datas, $result[$filter]);
}
}
}
echo json_encode($datas);
} | CWE-78 | 6 |
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 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.