code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
private function load($id)
{
try {
$select = $this->zdb->select(self::TABLE);
$select->limit(1)->where(self::PK . ' = ' . $id);
$results = $this->zdb->execute($select);
$res = $results->current();
$this->id = $id;
$this->name = $res->type_name;
} catch (Throwable $e) {
Analog::log(
'An error occurred loading payment type #' . $id . "Message:\n" .
$e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
$row_rub = sql_fetsel("id_rubrique", "spip_rubriques",
"lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=$id_parent");
if ($row_rub) {
$row['id_rubrique'] = $row_rub['id_rubrique'];
}
}
}
}
return $row;
} | CWE-94 | 14 |
public function update($key, $qty) {
if ((int)$qty && ((int)$qty > 0)) {
$this->session->data['cart'][$key] = (int)$qty;
} else {
$this->remove($key);
}
$this->data = array();
} | CWE-918 | 16 |
$resp = $this->asEditor()->get($entity->getUrl('/export/html'));
$resp->assertDontSee('window.donkey');
$resp->assertDontSee('script');
$resp->assertSee('.my-test-class { color: red; }');
} | CWE-79 | 1 |
public static function destroy () {
session_destroy();
unset($_SESSION['gxsess']);
}
| CWE-89 | 0 |
foreach ($elem[2] as $field) {
echo '
<tr class="tr_fields itemCatName_'.$itemCatName.'">
<td valign="top" class="td_title"> <span class="ui-icon ui-icon-carat-1-e" style="float: left; margin: 0 .3em 0 15px; font-size:9px;"> </span><i>'.$field[1].'</i> :</td>
<td>
<div id="id_field_'.$field[0].'" style="display:inline;" class="fields_div"></div><input type="hidden" id="hid_field_'.$field[0].'" class="fields" />
</td>
</tr>';
} | 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 |
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-22 | 2 |
public function validateByMode(App\Request $request)
{
if ($request->isEmpty('purifyMode') || !$request->has('value')) {
throw new \App\Exceptions\NoPermitted('ERR_ILLEGAL_VALUE', 406);
}
$response = new Vtiger_Response();
$response->setResult([
'raw' => $request->getByType('value', $request->getByType('purifyMode')),
]);
$response->emit();
} | CWE-434 | 5 |
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 getQuerySelect()
{
// SubmittedOn is stored in the artifact
return "a.submitted_on AS `" . $this->name . "`";
} | CWE-89 | 0 |
private function getCategory()
{
$category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));
if (empty($category)) {
throw new PageNotFoundException();
}
return $category;
} | CWE-639 | 9 |
public function 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 testCreateRelationshipMeta()
{
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta(null, null, null, array(), null);
self::assertCount(1, $GLOBALS['log']->calls['fatal']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta(null, null, null, array(), 'Contacts');
self::assertCount(1, $GLOBALS['log']->calls['fatal']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta(null, null, null, array(), 'Contacts', true);
self::assertCount(1, $GLOBALS['log']->calls['fatal']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta('User', null, null, array(), 'Contacts');
self::assertCount(6, $GLOBALS['log']->calls['fatal']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta('User', $this->db, null, array(), 'Contacts');
self::assertNotTrue(isset($GLOBALS['log']->calls['fatal']));
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta('Nonexists1', $this->db, null, array(), 'Nonexists2');
self::assertCount(1, $GLOBALS['log']->calls['debug']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta('User', null, null, array(), 'Contacts');
self::assertCount(6, $GLOBALS['log']->calls['fatal']);
} | CWE-1236 | 12 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($this->tagModel->remove($tag_id)) {
$this->flash->success(t('Tag removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
function showallSubcategories() {
// global $db;
expHistory::set('viewable', $this->params);
// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');
$catid = expSession::get('catid');
$parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0);
$category = new storeCategory($parent);
$categories = $category->getEcomSubcategories();
$ancestors = $category->pathToNode();
assign_to_template(array(
'categories' => $categories,
'ancestors' => $ancestors,
'category' => $category
));
} | CWE-89 | 0 |
public function display_sdm_other_details_meta_box($post) { //Other details metabox
$file_size = get_post_meta($post->ID, 'sdm_item_file_size', true);
$file_size = isset($file_size) ? $file_size : '';
$version = get_post_meta($post->ID, 'sdm_item_version', true);
$version = isset($version) ? $version : '';
echo '<div class="sdm-download-edit-filesize">';
_e('File Size: ', 'simple-download-monitor');
echo '<br />';
echo ' <input type="text" name="sdm_item_file_size" value="' . $file_size . '" size="20" />';
echo '<p class="description">' . __('Enter the size of this file (example value: 2.15 MB). You can show this value in the fancy display by using a shortcode parameter.', 'simple-download-monitor') . '</p>';
echo '</div>';
echo '<div class="sdm-download-edit-version">';
_e('Version: ', 'simple-download-monitor');
echo '<br />';
echo ' <input type="text" name="sdm_item_version" value="' . $version . '" size="20" />';
echo '<p class="description">' . __('Enter the version number for this item if any (example value: v2.5.10). You can show this value in the fancy display by using a shortcode parameter.', 'simple-download-monitor') . '</p>';
echo '</div>';
wp_nonce_field('sdm_other_details_nonce', 'sdm_other_details_nonce_check');
} | CWE-79 | 1 |
protected function getSubtask()
{
$subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id'));
if (empty($subtask)) {
throw new PageNotFoundException();
}
return $subtask;
} | CWE-639 | 9 |
public function take($value)
{
return $this->limit($value);
} | CWE-22 | 2 |
public function getQueryOrderby()
{
return $this->name;
} | CWE-89 | 0 |
public function getHeader($header)
{
$name = strtolower($header);
return isset($this->headers[$name]) ? $this->headers[$name] : [];
} | CWE-89 | 0 |
function get_allowed_mime_types( $user = null ) {
$t = wp_get_mime_types();
unset( $t['swf'], $t['exe'] );
if ( function_exists( 'current_user_can' ) )
$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
if ( empty( $unfiltered ) )
unset( $t['htm|html'] );
/**
* Filters list of allowed mime types and file extensions.
*
* @since 2.0.0
*
* @param array $t Mime types keyed by the file extension regex corresponding to
* those types. 'swf' and 'exe' removed from full list. 'htm|html' also
* removed depending on '$user' capabilities.
* @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
*/
return apply_filters( 'upload_mimes', $t, $user );
} | CWE-79 | 1 |
public function params()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
$this->create();
return;
}
$action = $this->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | CWE-639 | 9 |
function selectObjectBySql($sql) {
//$logFile = "C:\\xampp\\htdocs\\supserg\\tmp\\queryLog.txt";
//$lfh = fopen($logFile, 'a');
//fwrite($lfh, $sql . "\n");
//fclose($lfh);
$res = @mysqli_query($this->connection, $this->injectProof($sql));
if ($res == null)
return null;
return mysqli_fetch_object($res);
} | CWE-89 | 0 |
public function getQuerySelect()
{
return "a.id AS `" . $this->name . "`";
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$DB->query('SELECT * FROM nv_orders WHERE website = '.protect($website->id), 'object');
$out = $DB->result();
if($type='json')
$out = json_encode($out);
return $out;
}
| CWE-89 | 0 |
protected function _stat($path) {
static $statOwner;
if (is_null($statOwner)) {
$statOwner = (!empty($this->options['statOwner']));
}
$stat = array();
if (!file_exists($path) && !is_link($path)) {
return $stat;
}
//Verifies the given path is the root or is inside the root. Prevents directory traveral.
if (!$this->_inpath($path, $this->root)) {
return $stat;
}
$gid = $uid = 0;
$stat['isowner'] = false;
$linkreadable = false;
if ($path != $this->root && is_link($path)) {
if (! $this->options['followSymLinks']) {
return array();
}
if (!($target = $this->readlink($path))
|| $target == $path) {
if (is_null($target)) {
$stat = array();
return $stat;
} else {
$stat['mime'] = 'symlink-broken';
$target = readlink($path);
$lstat = lstat($path);
$ostat = $this->getOwnerStat($lstat['uid'], $lstat['gid']);
$linkreadable = !empty($ostat['isowner']);
}
}
$stat['alias'] = $this->_path($target);
$stat['target'] = $target;
}
$size = sprintf('%u', @filesize($path));
$stat['ts'] = filemtime($path);
if ($statOwner) {
$fstat = stat($path);
$uid = $fstat['uid'];
$gid = $fstat['gid'];
$stat['perm'] = substr((string)decoct($fstat['mode']), -4);
$stat = array_merge($stat, $this->getOwnerStat($uid, $gid));
}
$dir = is_dir($path);
if (!isset($stat['mime'])) {
$stat['mime'] = $dir ? 'directory' : $this->mimetype($path);
}
//logical rights first
$stat['read'] = ($linkreadable || is_readable($path))? null : false;
$stat['write'] = is_writable($path)? null : false;
if (is_null($stat['read'])) {
$stat['size'] = $dir ? 0 : $size;
}
return $stat;
} | CWE-89 | 0 |
public function save_change_password() {
global $user;
$isuser = ($this->params['uid'] == $user->id) ? 1 : 0;
if (!$user->isAdmin() && !$isuser) {
flash('error', gt('You do not have permissions to change this users password.'));
expHistory::back();
}
if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) {
flash('error', gt('The current password you entered is not correct.'));
expHistory::returnTo('editable');
}
//eDebug($user);
$u = new user($this->params['uid']);
$ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']);
//eDebug($u, true);
if (is_string($ret)) {
flash('error', $ret);
expHistory::returnTo('editable');
} else {
$params = array();
$params['is_admin'] = !empty($u->is_admin);
$params['is_acting_admin'] = !empty($u->is_acting_admin);
$u->update($params);
}
if (!$isuser) {
flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.'));
} else {
$user->password = $u->password;
flash('message', gt('Your password has been changed.'));
}
expHistory::back();
} | CWE-89 | 0 |
public static function isActive($mod){
$json = Options::v('modules');
$mods = json_decode($json, true);
//print_r($mods);
if (!is_array($mods) || $mods == "") {
$mods = array();
}
if(in_array($mod, $mods)){
return true;
}else{
return false;
}
}
| CWE-89 | 0 |
$item = array();
$item['id'] = $incident->id;
$item['title'] = $incident->incident_title;
$item['link'] = $site_url.'reports/view/'.$incident->id;
$item['description'] = $incident->incident_description;
$item['date'] = $incident->incident_date;
$item['categories'] = $categories;
if
(
$incident->location_id != 0 AND
$incident->location->longitude AND
$incident->location->latitude
)
{
$item['point'] = array(
$incident->location->latitude,
$incident->location->longitude
);
$items[] = $item;
}
}
$cache->set($subdomain.'_feed_'.$limit.'_'.$page, $items, array('feed'), 3600); // 1 Hour
$feed_items = $items;
}
$feedpath = $feedtype == 'atom' ? 'feed/atom/' : 'feed/';
//header("Content-Type: text/xml; charset=utf-8");
$view = new View('feed/'.$feedtype);
$view->feed_title = htmlspecialchars(Kohana::config('settings.site_name'));
$view->site_url = $site_url;
$view->georss = 1; // this adds georss namespace in the feed
$view->feed_url = $site_url.$feedpath;
$view->feed_date = gmdate("D, d M Y H:i:s T", time());
$view->feed_description = htmlspecialchars(Kohana::lang('ui_admin.incident_feed').' '.Kohana::config('settings.site_name'));
$view->items = $feed_items;
$view->render(TRUE);
} | CWE-79 | 1 |
function init_args()
{
$_REQUEST = strings_stripSlashes($_REQUEST);
$args = new stdClass();
$args->user_id = $_SESSION['userID'];
$args->tproject_id = $_SESSION['testprojectID'];
$args->tproject_name = $_SESSION['testprojectName'];
$args->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUEST['tplan_id'] : $_SESSION['testplanID'];
$args->id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
$args->version_id = isset($_REQUEST['version_id']) ? $_REQUEST['version_id'] : 0;
$args->level = isset($_REQUEST['level']) ? $_REQUEST['level'] : null;
// Can be a list (string with , (comma) has item separator),
$args->keyword_id = isset($_REQUEST['keyword_id']) ? $_REQUEST['keyword_id'] : 0;
return $args;
} | CWE-89 | 0 |
function testMissingExtensionFatal()
{
$ext = 'php_ext';
$warn = 'The <a href="' . PMA_getPHPDocLink('book.' . $ext . '.php')
. '" target="Documentation"><em>' . $ext
. '</em></a> extension is missing. Please check your PHP configuration.';
$this->expectOutputRegex('@' . preg_quote($warn) . '@');
PMA_warnMissingExtension($ext, true);
} | CWE-94 | 14 |
public static function userid($id){
$usr = Db::result(
sprintf("SELECT * FROM `user` WHERE `id` = '%d' LIMIT 1",
Typo::int($id)
)
);
return $usr[0]->userid;
}
| CWE-89 | 0 |
private function curl($url){
$ca = curl_init();
curl_setopt($ca, CURLOPT_URL, $url);
curl_setopt($ca, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ca, CURLOPT_HEADER, FALSE);
curl_setopt($ca, CURLOPT_HTTPHEADER, array("Accept: application/json"));
$response = curl_exec($ca);
curl_close($ca);
//var_dump($response);
$result = json_decode($response, true);
return $result;
}
| CWE-89 | 0 |
function insertCommandCategorieInDB(){
global $pearDB;
if (testCommandCategorieExistence($_POST["category_name"])){
$DBRESULT = $pearDB->query("INSERT INTO `command_categories` (`category_name` , `category_alias`, `category_order`) VALUES ('".$_POST["category_name"]."', '".$_POST["category_alias"]."', '1')");
}
} | CWE-89 | 0 |
public static function data($vars){
$file = GX_MOD.'/'.$vars.'/index.php';
$handle = fopen($file, 'r');
$data = fread($handle, filesize($file));
fclose($handle);
preg_match('/\* Name: (.*)\n\*/U', $data, $matches);
$d['name'] = $matches[1];
preg_match('/\* Desc: (.*)\n\*/U', $data, $matches);
$d['desc'] = $matches[1];
preg_match('/\* Version: (.*)\n\*/U', $data, $matches);
$d['version'] = $matches[1];
preg_match('/\* Build: (.*)\n\*/U', $data, $matches);
$d['build'] = $matches[1];
preg_match('/\* Developer: (.*)\n\*/U', $data, $matches);
$d['developer'] = $matches[1];
preg_match('/\* URI: (.*)\n\*/U', $data, $matches);
$d['url'] = $matches[1];
preg_match('/\* License: (.*)\n\*/U', $data, $matches);
$d['license'] = $matches[1];
preg_match('/\* Icon: (.*)\n\*/U', $data, $matches);
$d['icon'] = $matches[1];
return $d;
}
| CWE-89 | 0 |
function singleQuoteReplace($param1 = false, $param2 = false, $param3)
{
return str_replace("'", "''", str_replace("\'", "'", $param3));
} | CWE-22 | 2 |
static function activate($uid, $karmalevel = 'pear.dev')
{
require_once 'Damblan/Karma.php';
global $dbh, $auth_user;
$karma = new Damblan_Karma($dbh);
$user = user::info($uid, null, 0);
if (!isset($user['registered'])) {
return false;
}
@$arr = unserialize($user['userinfo']);
include_once 'pear-database-note.php';
note::removeAll($uid);
$data = array();
$data['registered'] = 1;
$data['active'] = 1;
/* $data['ppp_only'] = 0; */
if (is_array($arr)) {
$data['userinfo'] = $arr[1];
}
$data['created'] = gmdate('Y-m-d H:i');
$data['createdby'] = $auth_user->handle;
$data['handle'] = $user['handle'];
user::update($data, true);
$karma->grant($user['handle'], $karmalevel);
if ($karma->has($user['handle'], 'pear.dev')) {
include_once 'pear-rest.php';
$pear_rest = new pearweb_Channel_REST_Generator(PEAR_REST_PATH, $dbh);
$pear_rest->saveMaintainerREST($user['handle']);
$pear_rest->saveAllMaintainersREST();
}
include_once 'pear-database-note.php';
note::add($uid, "Account opened");
$msg = "Your PEAR account request has been opened.\n".
"To log in, go to http://" . PEAR_CHANNELNAME . "/ and click on \"login\" in\n".
"the top-right menu.\n";
$xhdr = 'From: ' . $auth_user->handle . '@php.net';
if (!DEVBOX) {
mail($user['email'], "Your PEAR Account Request", $msg, $xhdr, '-f ' . PEAR_BOUNCE_EMAIL);
}
return true;
} | CWE-502 | 15 |
function edit_internalalias() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
if (empty($section->id)) {
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
}
| CWE-89 | 0 |
public function request($method, $uri = null, array $options = [])
{
$options[RequestOptions::SYNCHRONOUS] = true;
return $this->requestAsync($method, $uri, $options)->wait();
} | CWE-89 | 0 |
Session::set(array('lang' => $lang ) );
}
| CWE-89 | 0 |
public static function getParent($id=''){
return Categories::getParent($id);
}
| CWE-89 | 0 |
public function fixsessions() {
global $db;
// $test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket');
$fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket');
flash('message', gt('Sessions Table was Repaired'));
expHistory::back();
} | CWE-89 | 0 |
public static function autoload() {
include (GX_LIB."Vendor/autoload.php");
}
| CWE-89 | 0 |
public static function getFolder() {
$uri = explode('/', Site::$url);
if(count($uri) > 3) {
unset($uri[0]);
unset($uri[1]);
unset($uri[2]);
$uri = array_values($uri);
$uris = "";
for($i=0; $i<count($uri); $i++){
$uris .= "/".$uri[$i];
}
return $uris;
}else{
return "/";
}
}
| CWE-89 | 0 |
public static function loadElementPaths($type, $object_id, $website_id=null)
{
global $DB;
global $website;
if(empty($website_id))
$website_id = $website->id;
$ok = $DB->query('
SELECT *
FROM nv_paths
WHERE type = '.protect($type).'
AND object_id = '.protect($object_id).'
AND website = '.$website_id
);
if(!$ok)
throw new Exception($DB->get_last_error());
$data = $DB->result();
if(!is_array($data)) $data = array();
$out = array();
foreach($data as $item)
{
$out[$item->lang] = $item->path;
}
return $out;
}
| CWE-89 | 0 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-79 | 1 |
public static function ca()
{
if (is_null(self::$ca)) new CertificateAuthenticate();
return self::$ca;
} | CWE-502 | 15 |
public function addUser(){
$login_user = $this->checkLogin();
$this->checkAdmin();
$username = I("post.username");
$password = I("post.password");
$uid = I("post.uid");
$name = I("post.name");
if(!$username){
$this->sendError(10101,'用户名不允许为空');
return ;
}
if($uid){
if($password){
D("User")->updatePwd($uid, $password);
}
if($name){
D("User")->where(" uid = '$uid' ")->save(array("name"=>$name));
}
$this->sendResult(array());
}else{
if (D("User")->isExist($username)) {
$this->sendError(10101,L('username_exists'));
return ;
}
$new_uid = D("User")->register($username,$password);
if (!$new_uid) {
$this->sendError(10101);
}else{
if($name){
D("User")->where(" uid = '$new_uid' ")->save(array("name"=>$name));
}
$this->sendResult($return);
}
}
} | CWE-89 | 0 |
public static function cleanX ($c) {
$val = self::strip_tags_content($c, '<script>', TRUE);
$val = htmlspecialchars(
$val,
ENT_QUOTES|ENT_HTML5,
"utf-8"
);
// $val = htmlentities(
// $c,
// ENT_QUOTES | ENT_IGNORE, "UTF-8");
return $val;
} | CWE-89 | 0 |
$files[$key]->save();
}
// eDebug($files,true);
} | CWE-89 | 0 |
public function manage_messages() {
expHistory::set('manageable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status_messages',
'where'=>1,
'limit'=>10,
'order'=>'body',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
//'columns'=>array('Name'=>'title')
));
//eDebug($page);
assign_to_template(array(
'page'=>$page
));
} | CWE-89 | 0 |
function get_show_item ($directory, $file)
{
if ( preg_match( "/\.\./", $directory ) )
return false;
if ( isset($file) && preg_match( "/\.\./", $file ) )
return false;
// dont display own directory
if ( $file == "." )
return false;
if ( substr( $file, 0, 1) == "." && $GLOBALS["show_hidden"] == false )
return false;
if (matches_noaccess_pattern($file))
return false;
if ( $GLOBALS["show_hidden"] == false )
{
$directory_parts = explode( "/", $directory );
foreach ($directory_parts as $directory_part )
{
if ( substr ( $directory_part, 0, 1) == "." )
return false;
}
}
return true;
} | CWE-22 | 2 |
public function delete() {
global $db, $history;
/* 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'];
if (empty($this->params['id'])) {
flash('error', gt('Missing id for the comment you would like to delete'));
$lastUrl = expHistory::getLast('editable');
}
// delete the note
$simplenote = new expSimpleNote($this->params['id']);
$rows = $simplenote->delete();
// delete the assocication too
$db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']);
// send the user back where they came from.
$lastUrl = expHistory::getLast('editable');
if (!empty($this->params['tab']))
{
$lastUrl .= "#".$this->params['tab'];
}
redirect_to($lastUrl);
} | CWE-89 | 0 |
public function getFlashCookieObject($name)
{
if (isset($_COOKIE[$name])) {
$object = json_decode($_COOKIE[$name], false);
setcookie($name, '', time() - 3600, '/');
return $object;
}
return null;
} | CWE-565 | 17 |
$pageView = $this->get($page->getUrl());
$pageView->assertStatus(200);
$pageView->assertElementNotContains('.page-content', '<a id="xss">');
$pageView->assertElementNotContains('.page-content', 'href=javascript:');
} | CWE-79 | 1 |
public function limit($value)
{
if ($value >= 0) {
$this->limit = $value;
}
return $this;
} | CWE-22 | 2 |
public function changeTableInfoAction()
{
$field = $_REQUEST['field'];
if ($field == 'pma_null') {
$this->response->addJSON('field_type', '');
$this->response->addJSON('field_collation', '');
$this->response->addJSON('field_operators', '');
$this->response->addJSON('field_value', '');
return;
}
$key = array_search($field, $this->_columnNames);
$properties = $this->getColumnProperties($_REQUEST['it'], $key);
$this->response->addJSON(
'field_type', htmlspecialchars($properties['type'])
);
$this->response->addJSON('field_collation', $properties['collation']);
$this->response->addJSON('field_operators', $properties['func']);
$this->response->addJSON('field_value', $properties['value']);
} | CWE-79 | 1 |
public static function modList()
{
//$mod = '';
$handle = dir(GX_MOD);
while (false !== ($entry = $handle->read())) {
if ($entry != '.' && $entry != '..') {
$dir = GX_MOD.$entry;
if (is_dir($dir) == true) {
(file_exists($dir.'/index.php')) ? $mod[] = basename($dir) : '';
}
}
}
$handle->close();
return $mod;
} | CWE-89 | 0 |
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
} | CWE-89 | 0 |
function connect() {
return $this->connectToServer($this->fields['host'], $this->fields['port'],
$this->fields['rootdn'],
Toolbox::decrypt($this->fields['rootdn_passwd'], GLPIKEY),
$this->fields['use_tls'],
$this->fields['deref_option']);
} | CWE-798 | 18 |
public function setContainer($container)
{
$this->container = $container;
$container->setType('ctArticles');
} | CWE-79 | 1 |
public function confirm()
{
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
$this->response->html($this->template->render('project_tag/remove', array(
'tag' => $tag,
'project' => $project,
)));
} | CWE-639 | 9 |
public function __construct()
{
$this->options['alias'] = ''; // alias to replace root dir name
$this->options['dirMode'] = 0755; // new dirs mode
$this->options['fileMode'] = 0644; // new files mode
$this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden)
$this->options['rootCssClass'] = 'elfinder-navbar-root-local';
$this->options['followSymLinks'] = true;
$this->options['detectDirIcon'] = ''; // file name that is detected as a folder icon e.g. '.diricon.png'
$this->options['keepTimestamp'] = array('copy', 'move'); // keep timestamp at inner filesystem allowed 'copy', 'move' and 'upload'
$this->options['substituteImg'] = true; // support substitute image with dim command
$this->options['statCorrector'] = null; // callable to correct stat data `function(&$stat, $path, $statOwner, $volumeDriveInstance){}`
} | CWE-78 | 6 |
function functions_list()
{
$navibars = new navibars();
$navitable = new navitable("functions_list");
$navibars->title(t(244, 'Menus'));
$navibars->add_actions( array( '<a href="?fid='.$_REQUEST['fid'].'&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> '.t(38, 'Create').'</a>',
'<a href="?fid='.$_REQUEST['fid'].'&act=0"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> '.t(39, 'List').'</a>',
'search_form' ));
if($_REQUEST['quicksearch']=='true')
{
$navitable->setInitialURL("?fid=".$_REQUEST['fid'].'&act=json&_search=true&quicksearch='.$_REQUEST['navigate-quicksearch']);
}
$navitable->setURL('?fid='.$_REQUEST['fid'].'&act=json');
$navitable->sortBy('id');
$navitable->setDataIndex('id');
$navitable->setEditUrl('id', '?fid='.$_REQUEST['fid'].'&act=edit&id=');
$navitable->addCol("ID", 'id', "80", "true", "left");
$navitable->addCol(t(237, 'Code'), 'codename', "100", "true", "left");
$navitable->addCol(t(242, 'Icon'), 'icon', "50", "true", "center");
$navitable->addCol(t(67, 'Title'), 'lid', "200", "true", "left");
$navitable->addCol(t(65, 'Enabled'), 'enabled', "80", "true", "center");
$navibars->add_content($navitable->generate());
return $navibars->generate();
}
| CWE-79 | 1 |
public function offset($value)
{
$this->offset = max(0, $value);
return $this;
} | CWE-79 | 1 |
public function setLoggerChannel($channel = 'Organizr', $username = null)
{
if ($this->hasDB()) {
$setLogger = false;
if ($username) {
$username = htmlspecialchars($username);
}
if ($this->logger) {
if ($channel) {
if (strtolower($this->logger->getChannel()) !== strtolower($channel)) {
$setLogger = true;
}
}
if ($username) {
if (strtolower($this->logger->getTraceId()) !== strtolower($channel)) {
$setLogger = true;
}
}
} else {
$setLogger = true;
}
if ($setLogger) {
$channel = $channel ?: 'Organizr';
return $this->setupLogger($channel, $username);
} else {
return $this->logger;
}
}
} | CWE-79 | 1 |
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id);
if (!empty($newret)) $ret .= $newret . '<br>';
if ($iLoc->mod == 'container') {
$ret .= scan_container($container->internal, $page_id);
}
}
return $ret;
}
| CWE-89 | 0 |
function productFeed() {
// global $db;
//check query password to avoid DDOS
/*
* condition = new
* description
* id - SKU
* link
* price
* title
* brand - manufacturer
* image link - fullsized image, up to 10, comma seperated
* product type - category - "Electronics > Audio > Audio Accessories MP3 Player Accessories","Health & Beauty > Healthcare > Biometric Monitors > Pedometers"
*/
$out = '"id","condition","description","like","price","title","brand","image link","product type"' . chr(13) . chr(10);
$p = new product();
$prods = $p->find('all', 'parent_id=0 AND ');
//$prods = $db->selectObjects('product','parent_id=0 AND');
} | CWE-89 | 0 |
private function getMergeSql()
{
switch ($this->driver) {
case 'mysql':
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ".
"ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)";
case 'oci':
// DUAL is Oracle specific dummy table
return "MERGE INTO $this->table USING DUAL ON ($this->idCol = :id) ".
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ".
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time";
case 'sqlsrv' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='):
// MERGE is only available since SQL Server 2008 and must be terminated by semicolon
// It also requires HOLDLOCK according to http://weblogs.sqlteam.com/dang/archive/2009/01/31/UPSERT-Race-Condition-With-MERGE.aspx
return "MERGE INTO $this->table WITH (HOLDLOCK) USING (SELECT 1 AS dummy) AS src ON ($this->idCol = :id) ".
"WHEN NOT MATCHED THEN INSERT ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ".
"WHEN MATCHED THEN UPDATE SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time;";
case 'sqlite':
return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)";
}
} | CWE-89 | 0 |
public static function getHelpVersion($version_id) {
global $db;
return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"');
} | CWE-89 | 0 |
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 |
public static function options($var) {
$file = GX_MOD.$var.'/options.php';
if(file_exists($file)){
include ($file);
}
}
| CWE-89 | 0 |
function edit() {
if (empty($this->params['content_id'])) {
flash('message',gt('An error occurred: No content id set.'));
expHistory::back();
}
/* The global constants can be overridden 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'];
$id = empty($this->params['id']) ? null : $this->params['id'];
$comment = new expComment($id);
//FIXME here is where we might sanitize the comment before displaying/editing it
assign_to_template(array(
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'comment'=>$comment
));
} | CWE-89 | 0 |
function __construct()
{
# code...
self::$smtphost = Options::get('smtphost');
self::$smtpuser = Options::get('smtpuser');
self::$smtppass = Options::get('smtppass');
self::$smtpssl = Options::get('smtpssl');
self::$siteemail = Options::get('siteemail');
self::$sitename = Options::get('sitename');
} | CWE-89 | 0 |
public function execute(&$params){
$options = &$this->config['options'];
$notif = new Notification;
$notif->user = $this->parseOption('user', $params);
$notif->createdBy = 'API';
$notif->createDate = time();
// file_put_contents('triggerLog.txt',"\n".$notif->user,FILE_APPEND);
// if($this->parseOption('type',$params) == 'auto') {
// if(!isset($params['model']))
// return false;
// $notif->modelType = get_class($params['model']);
// $notif->modelId = $params['model']->id;
// $notif->type = $this->getNotifType();
// } else {
$notif->type = 'custom';
$notif->text = $this->parseOption('text', $params);
// }
if ($notif->save()) {
return array (true, "");
} else {
return array(false, array_shift($notif->getErrors()));
}
} | CWE-79 | 1 |
public function get_view_config() {
global $template;
// set paths we will search in for the view
$paths = array(
BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure',
BASE.'framework/modules/common/views/file/configure',
);
foreach ($paths as $path) {
$view = $path.'/'.$this->params['view'].'.tpl';
if (is_readable($view)) {
if (bs(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
if (bs3(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
$template = new controllertemplate($this, $view);
$ar = new expAjaxReply(200, 'ok');
$ar->send();
}
}
} | CWE-89 | 0 |
function delete_selected() {
$item = $this->event->find('first', 'id=' . $this->params['id']);
if ($item && $item->is_recurring == 1) {
$event_remaining = false;
$eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id);
foreach ($eventdates as $ed) {
if (array_key_exists($ed->id, $this->params['dates'])) {
$ed->delete();
} else {
$event_remaining = true;
}
}
if (!$event_remaining) {
$item->delete(); // model will also ensure we delete all event dates
}
expHistory::back();
} else {
notfoundController::handle_not_found();
}
}
| CWE-89 | 0 |
public function Hello($host = '') {
$this->error = null; // so no confusion is caused
if(!$this->connected()) {
$this->error = array(
"error" => "Called Hello() without being connected");
return false;
}
// if hostname for HELO was not specified send default
if(empty($host)) {
// determine appropriate default to send to server
$host = "localhost";
}
// Send extended hello first (RFC 2821)
if(!$this->SendHello("EHLO", $host)) {
if(!$this->SendHello("HELO", $host)) {
return false;
}
}
return true;
} | CWE-79 | 1 |
protected function _chmod($path, $mode) {
$modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode));
$ret = @chmod($path, $modeOct);
$ret && clearstatcache();
return $ret;
} | CWE-89 | 0 |
protected function getCheckFileQuery()
{
global $zdb;
$select = $zdb->select(self::TABLE);
$select->columns(
array(
'picture',
'format'
)
);
$select->where(self::PK . ' = ' . $this->db_id);
return $select;
} | CWE-89 | 0 |
$count += $db->dropTable($basename);
}
flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');
expHistory::back();
} | 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 |
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name);
if (!$view) {
// unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child
$attr = new stdClass();
$attr->class = 'hidden'; // bs3 class to hide elements
$navs[$i]->li_attr = $attr;
}
}
| CWE-89 | 0 |
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_restriction/show', array(
'status_list' => array(
SubtaskModel::STATUS_TODO => t('Todo'),
SubtaskModel::STATUS_DONE => t('Done'),
),
'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
// global $db;
$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("\,", ",", $str);
$str = str_replace('""', '"', $str); //do this no matter what...in case someone added a quote in a non HTML field
if (!$isHTML) {
//if HTML, then leave the single quotes alone, otheriwse replace w/ special Char
$str = str_replace('"', """, $str);
}
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
// if (DB_ENGINE=='mysqli') {
// $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "™", $str)));
// } elseif(DB_ENGINE=='mysql') {
// $str = @mysql_real_escape_string(trim(str_replace("�", "™", $str)),$db->connection);
// } else {
// $str = trim(str_replace("�", "™", $str));
// }
$str = @expString::escape(trim(str_replace("�", "™", $str)));
//echo "2<br>"; eDebug($str,die);
return $str;
} | CWE-89 | 0 |
static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1,
$onlyglobal = 0, $used = []) {
global $CFG_GLPI;
$rand = mt_rand();
$field_id = Html::cleanId("dropdown_".$myname.$rand);
$param = [
'entity_restrict' => $entity_restrict,
'fromtype' => $fromtype,
'itemtype' => $itemtype,
'onlyglobal' => $onlyglobal,
'used' => $used,
'_idor_token' => Session::getNewIDORToken($itemtype),
];
echo Html::jsAjaxDropdown($myname, $field_id,
$CFG_GLPI['root_doc']."/ajax/getDropdownConnect.php",
$param);
return $rand;
} | CWE-639 | 9 |
public function setObjectSrc(Response $response)
{
if (config('app.allow_content_scripts')) {
return;
}
$response->headers->set('Content-Security-Policy', 'object-src \'self\'', false);
} | CWE-79 | 1 |
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 |
function fix_serialized_columns()
{
global $smcFunc;
$request = $smcFunc['db_query']('', '
SELECT id_action, extra
FROM {db_prefix}log_actions
WHERE action IN ({string:remove}, {string:delete})',
array(
'remove' => 'remove',
'delete' => 'delete',
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
{
if (@unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\d+;s:7:"subject";s:)(\d+):"(.+)"(;s:6:"member";s:5:"\d+";})$~', $row['extra'], $matches) === 1)
$smcFunc['db_query']('', '
UPDATE {db_prefix}log_actions
SET extra = {string:extra}
WHERE id_action = {int:current_action}',
array(
'current_action' => $row['id_action'],
'extra' => $matches[1] . strlen($matches[3]) . ':"' . $matches[3] . '"' . $matches[4],
)
);
}
$smcFunc['db_free_result']($request);
// Refresh some cached data.
updateSettings(array(
'memberlist_updated' => time(),
));
} | CWE-94 | 14 |
$pos = strpos($line, $match);
if ($pos !== false) {
$var = getvarname(strtok($field, '#'));
if ($var != '[]') eval('$r' . $var . '=$block;');
}
}
}
return $r;
} | CWE-94 | 14 |
public function event()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id'])) {
return $this->create();
}
return $this->response->html($this->template->render('action_creation/event', array(
'values' => $values,
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | CWE-639 | 9 |
public function getName($translated = true)
{
if ($translated === true) {
return _T($this->name);
} else {
return $this->name;
}
} | CWE-79 | 1 |
public function testCanSetHeaderAsArray()
{
$r = new Response(200, [
'foo' => ['baz ', ' bar ']
]);
$this->assertEquals('baz, bar', $r->getHeaderLine('foo'));
$this->assertEquals(['baz', 'bar'], $r->getHeader('foo'));
} | CWE-89 | 0 |
function searchName() { return gt('Webpage'); }
| CWE-89 | 0 |
public static function remove($var) {
unset($_SESSION['gxsess']['val'][$var]);
}
| CWE-89 | 0 |
public static function types_update($array)
{
global $DB;
global $website;
$array = array_filter($array);
sort($array);
$array = serialize($array);
$ok = $DB->execute('
UPDATE nv_websites
SET block_types = '.protect($array).'
WHERE id = '.$website->id
);
if(!$ok)
throw new Exception($DB->last_error());
return true;
}
| CWE-89 | 0 |
public static function load_element_strings($node_type, $node_id, $savedOn="latest")
{
global $DB;
// load all webdictionary history elements and keep only the latest
$DB->query('
SELECT subtype, lang, text
FROM nv_webdictionary_history
WHERE node_type = '.protect($node_type).'
AND node_id = '.protect($node_id).'
ORDER BY date_created ASC'
);
$data = $DB->result();
if(!is_array($data)) $data = array();
$dictionary = array();
foreach($data as $item)
{
$dictionary[$item->lang][$item->subtype] = $item->text;
}
return $dictionary;
}
| CWE-89 | 0 |
foreach ($days as $event) {
if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time()))
break;
if (empty($event->eventstart))
$event->eventstart = $event->eventdate->date;
$extitem[] = $event;
}
| CWE-89 | 0 |
$emails[$u->email] = trim(user::getUserAttribution($u->id));
}
| CWE-89 | 0 |