code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
public function withAddedHeader($header, $value)
{
if (!$this->hasHeader($header)) {
return $this->withHeader($header, $value);
}
$new = clone $this;
$new->headers[strtolower($header)][] = $value;
$new->headerLines[$header][] = $value;
return $new;
} | CWE-89 | 0 |
public function validate() {
global $db;
// check for an sef url field. If it exists make sure it's valid and not a duplicate
//this needs to check for SEF URLS being turned on also: TODO
if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) {
if (empty($this->sef_url)) $this->makeSefUrl();
if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();
if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();
}
// safeguard again loc data not being pass via forms...sometimes this happens when you're in a router
// mapped view and src hasn't been passed in via link to the form
if (isset($this->id) && empty($this->location_data)) {
$loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);
if (!empty($loc)) $this->location_data = $loc;
}
// run the validation as defined in the models
if (!isset($this->validates)) return true;
$messages = array();
$post = empty($_POST) ? array() : expString::sanitize($_POST);
foreach ($this->validates as $validation=> $field) {
foreach ($field as $key=> $value) {
$fieldname = is_numeric($key) ? $value : $key;
$opts = is_numeric($key) ? array() : $value;
$ret = expValidator::$validation($fieldname, $this, $opts);
if (!is_bool($ret)) {
$messages[] = $ret;
expValidator::setErrorField($fieldname);
unset($post[$fieldname]);
}
}
}
if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);
} | 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-640 | 20 |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | 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 |
function PMA_getCentralColumnsCount($db)
{
$cfgCentralColumns = PMA_centralColumnsGetParams();
if (empty($cfgCentralColumns)) {
return 0;
}
$pmadb = $cfgCentralColumns['db'];
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
$central_list_table = $cfgCentralColumns['table'];
$query = 'SELECT count(db_name) FROM ' .
Util::backquote($central_list_table) . ' '
. 'WHERE db_name = \'' . $db . '\';';
$res = $GLOBALS['dbi']->fetchResult(
$query, null, null, $GLOBALS['controllink']
);
if (isset($res[0])) {
return $res[0];
} else {
return 0;
}
} | CWE-89 | 0 |
public function approve_toggle() {
global $history;
if (empty($this->params['id'])) return;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
$require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
$require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
$require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
$notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
$simplenote = new expSimpleNote($this->params['id']);
$simplenote->approved = $simplenote->approved == 1 ? 0 : 1;
$simplenote->save();
$lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);
if (!empty($this->params['tab']))
{
$lastUrl .= "#".$this->params['tab'];
}
redirect_to($lastUrl);
} | CWE-89 | 0 |
public function downloadFiles() {
App()->loadLibrary('admin.pclzip');
$folder = basename(Yii::app()->request->getPost('folder', 'global'));
$files = Yii::app()->request->getPost('files');
$tempdir = Yii::app()->getConfig('tempdir');
$randomizedFileName = $folder.'_'.substr(md5(time()),3,13).'.zip';
$zipfile = $tempdir.DIRECTORY_SEPARATOR.$randomizedFileName;
$arrayOfFiles = array_map( function($file){ return $file['path']; }, $files);
$archive = new PclZip($zipfile);
$checkFileCreate = $archive->create($arrayOfFiles, PCLZIP_OPT_REMOVE_ALL_PATH);
$urlFormat = Yii::app()->getUrlManager()->getUrlFormat();
$getFileLink = Yii::app()->createUrl('admin/filemanager/sa/getZipFile');
if($urlFormat == 'path') {
$getFileLink .= '?path='.$zipfile;
} else {
$getFileLink .= '&path='.$zipfile;
}
$this->_printJsonResponse(
[
'success' => true,
'message' => sprintf(gT("Files are ready for download in archive %s."), $randomizedFileName),
'downloadLink' => $getFileLink ,
]
);
} | CWE-22 | 2 |
public static function _date2timestamp( $datetime, $wtz=null ) {
if( !isset( $datetime['hour'] )) $datetime['hour'] = 0;
if( !isset( $datetime['min'] )) $datetime['min'] = 0;
if( !isset( $datetime['sec'] )) $datetime['sec'] = 0;
if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || empty( $datetime['tz'] )))
return mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
$output = $offset = 0;
if( empty( $wtz )) {
if( iCalUtilityFunctions::_isOffset( $datetime['tz'] )) {
$offset = iCalUtilityFunctions::_tz2offset( $datetime['tz'] ) * -1;
$wtz = 'UTC';
}
else
$wtz = $datetime['tz'];
}
if(( 'Z' == $wtz ) || ( 'GMT' == strtoupper( $wtz )))
$wtz = 'UTC';
try {
$strdate = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['min'], $datetime['sec'] );
$d = new DateTime( $strdate, new DateTimeZone( $wtz ));
if( 0 != $offset ) // adjust for offset
$d->modify( $offset.' seconds' );
$output = $d->format( 'U' );
unset( $d );
}
catch( Exception $e ) {
$output = mktime( $datetime['hour'], $datetime['min'], $datetime['sec'], $datetime['month'], $datetime['day'], $datetime['year'] );
}
return $output;
}
| CWE-89 | 0 |
public function gc($maxlifetime)
{
$this->getCollection()->remove(array(
$this->options['expiry_field'] => array('$lt' => new \MongoDate()),
));
return true;
} | CWE-89 | 0 |
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
| CWE-89 | 0 |
public function getDigits($key, $default = '', $deep = false)
{
// we need to remove - and + because they're allowed in the filter
return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT, array(), $deep));
} | CWE-89 | 0 |
public function editTitle() {
global $user;
$file = new expFile($this->params['id']);
if ($user->id==$file->poster || $user->isAdmin()) {
$file->title = $this->params['newValue'];
$file->save();
$ar = new expAjaxReply(200, gt('Your title was updated successfully'), $file);
} else {
$ar = new expAjaxReply(300, gt("You didn't create this file, so you can't edit it."));
}
$ar->send();
} | CWE-89 | 0 |
public function manage()
{
expHistory::set('manageable',$this->params);
$gc = new geoCountry();
$countries = $gc->find('all');
$gr = new geoRegion();
$regions = $gr->find('all',null,'rank asc,name asc');
assign_to_template(array(
'countries'=>$countries,
'regions'=>$regions
));
} | CWE-89 | 0 |
Contacts::model()->deleteAll($criteria);
}
}
echo $model->id;
}
} | CWE-79 | 1 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-79 | 1 |
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 |
$masteroption->delete();
}
// delete the mastergroup
$db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id);
$mastergroup->delete();
expHistory::back();
} | CWE-89 | 0 |
public function testCreatesResponseWithAddedHeaderArray()
{
$r = new Response();
$r2 = $r->withAddedHeader('foo', ['baz', 'bar']);
$this->assertFalse($r->hasHeader('foo'));
$this->assertEquals('baz, bar', $r2->getHeaderLine('foo'));
} | CWE-89 | 0 |
public function __construct($strSystemid = "") {
//Generating all the required objects. For this we use our cool cool carrier-object
//take care of loading just the necessary objects
$objCarrier = class_carrier::getInstance();
$this->objConfig = $objCarrier->getObjConfig();
$this->objSession = $objCarrier->getObjSession();
$this->objLang = $objCarrier->getObjLang();
$this->objTemplate = $objCarrier->getObjTemplate();
//Setting SystemID
if($strSystemid == "") {
$this->setSystemid(class_carrier::getInstance()->getParam("systemid"));
}
else {
$this->setSystemid($strSystemid);
}
//And keep the action
$this->strAction = $this->getParam("action");
//in most cases, the list is the default action if no other action was passed
if($this->strAction == "") {
$this->strAction = "list";
}
//try to load the current module-name and the moduleId by reflection
$objReflection = new class_reflection($this);
if(!isset($this->arrModule["modul"])) {
$arrAnnotationValues = $objReflection->getAnnotationValuesFromClass(self::STR_MODULE_ANNOTATION);
if(count($arrAnnotationValues) > 0)
$this->setArrModuleEntry("modul", trim($arrAnnotationValues[0]));
}
if(!isset($this->arrModule["moduleId"])) {
$arrAnnotationValues = $objReflection->getAnnotationValuesFromClass(self::STR_MODULEID_ANNOTATION);
if(count($arrAnnotationValues) > 0)
$this->setArrModuleEntry("moduleId", constant(trim($arrAnnotationValues[0])));
}
$this->strLangBase = $this->getArrModule("modul");
} | CWE-79 | 1 |
$percent = round($percent, 0);
} else {
$percent = round($percent, 2); // school default
}
if ($ret == '%')
return $percent;
if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id])
$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TITLE,ID,BREAK_OFF FROM report_card_grades WHERE SYEAR=\'' . $cp[1]['SYEAR'] . '\' AND SCHOOL_ID=\'' . $cp[1]['SCHOOL_ID'] . '\' AND GRADE_SCALE_ID=\'' . $grade_scale_id . '\' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER'));
foreach ($_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) {
if ($does_breakoff == 'Y' ? $percent >= $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] && is_numeric($programconfig[$staff_id][$course_period_id . '-' . $grade['ID']]) : $percent >= $grade['BREAK_OFF'])
return $ret == 'ID' ? $grade['ID'] : $grade['TITLE'];
}
} | CWE-22 | 2 |
private function validateImageMetadata($data)
{
if (\is_array($data)) {
foreach ($data as $value) {
if (!$this->validateImageMetadata($value)) {
return false;
}
}
} else {
if (1 === preg_match('/(<\?php?(.*?))/i', $data) || false !== stripos($data, '<?=') || false !== stripos($data, '<? ')) {
return false;
}
}
return true;
} | CWE-79 | 1 |
function extract_plural_forms_header_from_po_header($header) {
if (preg_match("/(^|\n)plural-forms: ([^\n]*)\n/i", $header, $regs))
$expr = $regs[2];
else
$expr = "nplurals=2; plural=n == 1 ? 0 : 1;";
return $expr;
} | CWE-94 | 14 |
public function confirm()
{
$task = $this->getTask();
$comment = $this->getComment();
$this->response->html($this->template->render('comment/remove', array(
'comment' => $comment,
'task' => $task,
'title' => t('Remove a comment')
)));
} | CWE-639 | 9 |
protected function remove($path, $force = false)
{
$stat = $this->stat($path);
if (empty($stat)) {
return $this->setError(elFinder::ERROR_RM, $path, elFinder::ERROR_FILE_NOT_FOUND);
}
$stat['realpath'] = $path;
$this->rmTmb($stat);
$this->clearcache();
if (!$force && !empty($stat['locked'])) {
return $this->setError(elFinder::ERROR_LOCKED, $this->path($stat['hash']));
}
if ($stat['mime'] == 'directory' && empty($stat['thash'])) {
$ret = $this->delTree($this->convEncIn($path));
$this->convEncOut();
if (!$ret) {
return $this->setError(elFinder::ERROR_RM, $this->path($stat['hash']));
}
} else {
if ($this->convEncOut(!$this->_unlink($this->convEncIn($path)))) {
return $this->setError(elFinder::ERROR_RM, $this->path($stat['hash']));
}
$this->clearstatcache();
}
$this->removed[] = $stat;
return true;
} | CWE-78 | 6 |
public function newpassword() {
if ($token = $this->param('token')) {
$user = $this->app->storage->findOne('cockpit/accounts', ['_reset_token' => $token]);
if (!$user) {
return false;
}
$user['md5email'] = md5($user['email']);
return $this->render('cockpit:views/layouts/newpassword.php', compact('user', 'token'));
}
return false;
} | CWE-89 | 0 |
public function getLayout(){
$layout = $this->getAttribute('layout');
$initLayout = $this->initLayout();
if(!$layout){ // layout hasn't been initialized?
$layout = $initLayout;
$this->layout = json_encode($layout);
$this->update(array('layout'));
}else{
$layout = json_decode($layout, true); // json to associative array
$this->addRemoveLayoutElements('center', $layout, $initLayout);
$this->addRemoveLayoutElements('left', $layout, $initLayout);
$this->addRemoveLayoutElements('right', $layout, $initLayout);
}
return $layout;
} | CWE-79 | 1 |
private function getSwimlane()
{
$swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id'));
if (empty($swimlane)) {
throw new PageNotFoundException();
}
return $swimlane;
} | CWE-639 | 9 |
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 |
public function onRouteShutdown(Enlight_Controller_EventArgs $args)
{
$request = $args->getRequest();
$response = $args->getResponse();
if (Shopware()->Container()->initialized('shop')) {
/** @var DetachedShop $shop */
$shop = $this->get('shop');
if ($request->getHttpHost() !== $shop->getHost()) {
if ($request->isSecure()) {
$newPath = 'https://' . $shop->getHost() . $request->getRequestUri();
} else {
$newPath = 'http://' . $shop->getHost() . $shop->getBaseUrl();
}
}
// Strip /shopware.php/ from string and perform a redirect
$preferBasePath = $this->get(Shopware_Components_Config::class)->preferBasePath;
if ($preferBasePath && strpos($request->getPathInfo(), '/shopware.php/') === 0) {
$removePath = $request->getBasePath() . '/shopware.php';
$newPath = str_replace($removePath, $request->getBasePath(), $request->getRequestUri());
}
if (isset($newPath)) {
// reset the cookie so only one valid cookie will be set IE11 fix
$basePath = $shop->getBasePath();
if ($basePath === null || $basePath === '') {
$basePath = '/';
}
$response->headers->setCookie(new Cookie('session-' . $shop->getId(), '', 1, $basePath));
$response->setRedirect($newPath, 301);
} else {
$this->upgradeShop($request, $response);
$this->initServiceMode($request);
}
$this->get(ContextServiceInterface::class)->initializeShopContext();
}
} | CWE-601 | 11 |
public function testReturnsAsIsWhenNoChanges()
{
$request = new Psr7\Request('GET', 'http://foo.com');
$this->assertSame($request, Psr7\modify_request($request, []));
} | CWE-89 | 0 |
public function actionGetItems(){
$sql = 'SELECT id, name as value FROM x2_opportunities WHERE name LIKE :qterm ORDER BY name ASC';
$command = Yii::app()->db->createCommand($sql);
$qterm = $_GET['term'].'%';
$command->bindParam(":qterm", $qterm, PDO::PARAM_STR);
$result = $command->queryAll();
echo CJSON::encode($result);
Yii::app()->end();
} | CWE-79 | 1 |
return @unlink($dir);
}
return false;
} | CWE-89 | 0 |
private function load($id)
{
global $zdb;
try {
$select = $zdb->select(self::TABLE);
$select->limit(1)
->where(self::PK . ' = ' . $id);
$results = $zdb->execute($select);
$this->loadFromRs($results->current());
} catch (Throwable $e) {
Analog::log(
'An error occurred loading reminder #' . $id . "Message:\n" .
$e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | CWE-89 | 0 |
function selectArraysBySql($sql) {
$res = @mysqli_query($this->connection, $sql);
if ($res == null)
return array();
$arrays = array();
for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)
$arrays[] = mysqli_fetch_assoc($res);
return $arrays;
} | CWE-89 | 0 |
public function sdm_save_other_details_meta_data($post_id) { // Save Statistics Upload metabox
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (!isset($_POST['sdm_other_details_nonce_check']) || !wp_verify_nonce($_POST['sdm_other_details_nonce_check'], 'sdm_other_details_nonce')) {
return;
}
if (isset($_POST['sdm_item_file_size'])) {
update_post_meta($post_id, 'sdm_item_file_size', $_POST['sdm_item_file_size']);
}
if (isset($_POST['sdm_item_version'])) {
update_post_meta($post_id, 'sdm_item_version', $_POST['sdm_item_version']);
}
} | CWE-79 | 1 |
function manage_vendors () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
assign_to_template(array(
'vendors'=>$vendors
));
} | CWE-89 | 0 |
public function getQueryGroupby()
{
// SubmittedOn is stored in the artifact
return 'a.submitted_by';
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('
SELECT * FROM nv_webdictionary_history
WHERE website = '.protect($website->id),
'object'
);
if($type='json')
$out = json_encode($DB->result());
return $out;
}
| CWE-89 | 0 |
public function params()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
$this->create();
return;
}
$action = $this->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | CWE-639 | 9 |
public static function isActive($thm){
if(Options::v('themes') === $thm){
return true;
}else{
return false;
}
}
| CWE-89 | 0 |
public function beforeSave() {
if(strpos($this->tag,self::DELIM) !== false) {
$this->tag = strtr($this->tag,array(self::DELIM => ''));
}
return true;
} | CWE-79 | 1 |
function reparent_standalone() {
$standalone = $this->section->find($this->params['page']);
if ($standalone) {
$standalone->parent = $this->params['parent'];
$standalone->update();
expSession::clearAllUsersSessionCache('navigation');
expHistory::back();
} else {
notfoundController::handle_not_found();
}
}
| CWE-89 | 0 |
$contents = ['form' => tep_draw_form('languages', 'languages.php', 'page=' . $_GET['page'] . '&lID=' . $lInfo->languages_id . '&action=save')]; | CWE-79 | 1 |
public function searchNew() {
global $db, $user;
//$this->params['query'] = str_ireplace('-','\-',$this->params['query']);
$sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, ";
$sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) as relevance, ";
$sql .= "CASE when p.model like '" . $this->params['query'] . "%' then 1 else 0 END as modelmatch, ";
$sql .= "CASE when p.title like '%" . $this->params['query'] . "%' then 1 else 0 END as titlematch ";
$sql .= "from " . $db->prefix . "product as p INNER JOIN " .
$db->prefix . "content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN " . $db->prefix .
"expFiles as f ON cef.expFiles_id = f.id WHERE ";
if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';
$sql .= " match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) AND p.parent_id=0 ";
$sql .= " HAVING relevance > 0 ";
//$sql .= "GROUP BY p.id ";
$sql .= "order by modelmatch,titlematch,relevance desc LIMIT 10";
eDebug($sql);
$res = $db->selectObjectsBySql($sql);
eDebug($res, true);
$ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res);
$ar->send();
} | CWE-89 | 0 |
foreach ($nodes as $node) {
if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) {
if ($node->active == 1) {
$text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . $node->name;
} else {
$text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';
}
$ar[$node->id] = $text;
foreach (self::levelDropdownControlArray($node->id, $depth + 1, $ignore_ids, $full, $perm, $addstandalones, $addinternalalias) as $id => $text) {
$ar[$id] = $text;
}
}
}
| CWE-89 | 0 |
protected function canCreateTmb($path, $stat, $checkTmbPath = true) {
return (!$checkTmbPath || $this->tmbPathWritable)
&& (!$this->tmbPath || strpos($path, $this->tmbPath) === false) // do not create thumnbnail for thumnbnail
&& $this->imgLib
&& strpos($stat['mime'], 'image') === 0
&& ($this->imgLib == 'gd' ? in_array($stat['mime'], array('image/jpeg', 'image/png', 'image/gif', 'image/x-ms-bmp')) : true);
} | CWE-89 | 0 |
public function getSiteInfo()
{
// check for a site request param
if(empty($this->getSite())){
$this->setName(get_bloginfo('name'));
$this->setDescription(get_bloginfo('description'));
$this->setRestApiUrl(get_rest_url());
$this->setSite(get_bloginfo('url'));
$this->setLocal(true);
return;
}
// If they forgot to add http(s), add it for them.
if(strpos($this->getSite(), 'http://') === false && strpos($this->getSite(), 'https://') === false) {
$this->setSite( 'http://' . $this->getSite());
}
// if there is one, check if it exists in wordpress.com, eg "retirementreflections.com"
$site = trailingslashit(sanitize_text_field($this->getSite()));
// Let's see if it's self-hosted...
$data = $this->getSelfHostedSiteInfo($site);
// if($data === false){
// // Alright, there was no link to the REST API index. But maybe it's a WordPress.com site...
// $data = $this->guessSelfHostedSiteInfo($site);
// }
if($data === false){
// Alright, there was no link to the REST API index. But maybe it's a WordPress.com site...
$data = $this->getWordPressComSiteInfo($site);
}
return $data;
} | CWE-918 | 16 |
public function update()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
if ($valid) {
if ($this->swimlaneModel->update($values['id'], $values)) {
$this->flash->success(t('Swimlane updated successfully.'));
return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} else {
$errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
}
}
return $this->edit($values, $errors);
} | CWE-639 | 9 |
public function 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 |
protected function connect() {
$user = $this->getUser();
$workgroup = null;
if (strpos($user, '/')) {
list($workgroup, $user) = explode('/', $user);
}
$this->state->init($workgroup, $user, $this->getPassword());
} | CWE-78 | 6 |
public function testDeleteRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId, $expectedCode)
{
$request = new Enlight_Controller_Request_RequestTestCase();
$request->setMethod('DELETE');
$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($expectedCode, $response->getHttpResponseCode());
} | CWE-601 | 11 |
public function getPurchaseOrderByJSON() {
if(!empty($this->params['vendor'])) {
$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);
} else {
$purchase_orders = $this->purchase_order->find('all');
}
echo json_encode($purchase_orders);
} | CWE-89 | 0 |
public static function start() {
session_name('GeniXCMS');
session_start();
//unset($_SESSION);
if (!isset($_SESSION['gxsess']) || $_SESSION['gxsess'] == "" ) {
$_SESSION['gxsess'] = array (
'key' => self::sesKey(),
'time' => date("Y-m-d H:i:s"),
'val' => array()
);
}
$GLOBALS['start_time'] = microtime(TRUE);
}
| CWE-89 | 0 |
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'");
}
if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);
// eDebug($sql, true);
// count the unapproved comments
if ($require_approval == 1 && $user->isAdmin()) {
$sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com ';
$sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id ';
$sql .= 'WHERE cnt.content_id='.$this->params['content_id']." AND cnt.content_type='".$this->params['content_type']."' ";
$sql .= 'AND com.approved=0';
$unapproved = $db->countObjectsBySql($sql);
} else {
$unapproved = 0;
}
$this->config = $this->params['config'];
$type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment');
$ratings = !empty($this->params['ratings']) ? true : false;
assign_to_template(array(
'comments'=>$comments,
'config'=>$this->params['config'],
'unapproved'=>$unapproved,
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'user'=>$user,
'hideform'=>$this->params['hideform'],
'hidecomments'=>$this->params['hidecomments'],
'title'=>$this->params['title'],
'formtitle'=>$this->params['formtitle'],
'type'=>$type,
'ratings'=>$ratings,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
));
} | CWE-89 | 0 |
public function editspeed() {
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']);
assign_to_template(array(
'calculator'=>$calc
));
} | CWE-89 | 0 |
public function testNameExceptionPhp54()
{
session_start();
$this->proxy->setName('foo');
} | CWE-89 | 0 |
public function confirm()
{
$task = $this->getTask();
$comment = $this->getComment();
$this->response->html($this->template->render('comment/remove', array(
'comment' => $comment,
'task' => $task,
'title' => t('Remove a comment')
)));
} | CWE-639 | 9 |
public function 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 IsQmail() {
if (stristr(ini_get('sendmail_path'), 'qmail')) {
$this->Sendmail = '/var/qmail/bin/sendmail';
}
$this->Mailer = 'sendmail';
} | CWE-79 | 1 |
function svn_utils_criteria_list_to_query($criteria_list)
{
$criteria_list = str_replace('>', ' ASC', $criteria_list);
$criteria_list = str_replace('<', ' DESC', $criteria_list);
return $criteria_list;
} | CWE-89 | 0 |
foreach($image->expTag as $tag) {
if (isset($used_tags[$tag->id])) {
$used_tags[$tag->id]->count++;
} else {
$exptag = new expTag($tag->id);
$used_tags[$tag->id] = $exptag;
$used_tags[$tag->id]->count = 1;
}
} | CWE-89 | 0 |
protected function getSubtask()
{
$subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id'));
if (empty($subtask)) {
throw new PageNotFoundException();
}
return $subtask;
} | CWE-639 | 9 |
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
$str = str_replace("�", "’", $str);
$str = str_replace("�", "‘", $str);
$str = str_replace("�", "®", $str);
$str = str_replace("�", "-", $str);
$str = str_replace("�", "—", $str);
$str = str_replace("�", "”", $str);
$str = str_replace("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
$str = str_replace("\t", " ", $str);
$str = str_replace(",", "\,", $str);
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
if (!$isHTML) {
$str = str_replace('\"', """, $str);
$str = str_replace('"', """, $str);
} else {
$str = str_replace('"', '""', $str);
}
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
$str = trim(str_replace("�", "™", $str));
//echo "2<br>"; eDebug($str,die);
return $str;
} | CWE-89 | 0 |
public function delete_version() {
if (empty($this->params['id'])) {
flash('error', gt('The version you are trying to delete could not be found'));
}
// get the version
$version = new help_version($this->params['id']);
if (empty($version->id)) {
flash('error', gt('The version you are trying to delete could not be found'));
}
// if we have errors than lets get outta here!
if (!expQueue::isQueueEmpty('error')) expHistory::back();
// delete the version
$version->delete();
expSession::un_set('help-version');
flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.'));
expHistory::back();
} | CWE-89 | 0 |
$save_value = expString::sanitize($value);
$_REQUEST[$key] = $save_value;
$_GET[$key] = $save_value;
}
return true;
} | CWE-89 | 0 |
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 |
public function execute()
{
parent::execute();
// get parameters
$term = SpoonFilter::getPostValue('term', null, '');
// validate
if($term == '') $this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
// previous search result
$previousTerm = SpoonSession::exists('searchTerm') ? SpoonSession::get('searchTerm') : '';
SpoonSession::set('searchTerm', '');
// save this term?
if($previousTerm != $term)
{
// format data
$this->statistics = array();
$this->statistics['term'] = $term;
$this->statistics['language'] = FRONTEND_LANGUAGE;
$this->statistics['time'] = FrontendModel::getUTCDate();
$this->statistics['data'] = serialize(array('server' => $_SERVER));
$this->statistics['num_results'] = FrontendSearchModel::getTotal($term);
// save data
FrontendSearchModel::save($this->statistics);
}
// save current search term in cookie
SpoonSession::set('searchTerm', $term);
// output
$this->output(self::OK);
} | 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 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, $sql);
if ($res == null)
return null;
return mysqli_fetch_object($res);
} | 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 |
public function manage() {
expHistory::set('manageable', $this->params);
// build out a SQL query that gets all the data we need and is sortable.
$sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id ';
$sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f ';
$sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type="banner")';
$page = new expPaginator(array(
'model'=>'banner',
'sql'=>$sql,
'order'=>'title',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title',
gt('Company')=>'companyname',
gt('Impressions')=>'impressions',
gt('Clicks')=>'clicks'
)
));
assign_to_template(array(
'page'=>$page
));
} | CWE-89 | 0 |
protected function signDocument(\DOMDocument $document, $node)
{
$this->add509Cert($this->getCertificate()->getPublicKey()->getX509Certificate());
$this->setCanonicalMethod(XMLSecurityDSig::EXC_C14N);
$this->addReference($document->documentElement, XMLSecurityDSig::SHA1, array('http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N), array('id_name' => 'ID'));
$this->sign($this->getCertificate()->getPrivateKey());
$this->insertSignature($document->firstChild, $node);
$this->canonicalizeSignedInfo();
} | CWE-347 | 25 |
private function getNewPrinter() {
$printer = getItemByTypeName('Printer', '_test_printer_all');
$pfields = $printer->fields;
unset($pfields['id']);
unset($pfields['date_creation']);
unset($pfields['date_mod']);
$pfields['name'] = $this->getUniqueString();
$this->integer((int)$printer->add($pfields))->isGreaterThan(0);
return $printer;
} | CWE-89 | 0 |
$bdd->exec($sql);
}
}
} | CWE-78 | 6 |
$this->services['App\Bus'] = $instance = new \App\Bus(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}); | CWE-89 | 0 |
public function save(){
$cat_name = I("cat_name");
$s_number = I("s_number/d") ? I("s_number/d") : 99 ;
$cat_id = I("cat_id/d")? I("cat_id/d") : 0;
$parent_cat_id = I("parent_cat_id/d")? I("parent_cat_id/d") : 0;
$item_id = I("item_id/d");
$login_user = $this->checkLogin();
if (!$this->checkItemPermn($login_user['uid'] , $item_id)) {
$this->sendError(10103);
return;
}
//禁止空目录的生成
if (!$cat_name) {
return;
}
if ($parent_cat_id && $parent_cat_id == $cat_id) {
$this->sendError(10101,"上级目录不能选择自身");
return;
}
$data['cat_name'] = $cat_name ;
$data['s_number'] = $s_number ;
$data['item_id'] = $item_id ;
$data['parent_cat_id'] = $parent_cat_id ;
if ($parent_cat_id > 0 ) {
$row = D("Catalog")->where(" cat_id = '$parent_cat_id' ")->find() ;
$data['level'] = $row['level'] +1 ;
}else{
$data['level'] = 2;
}
if ($cat_id > 0 ) {
//如果一个目录已经是别的目录的父目录,那么它将无法再转为level4目录
if (D("Catalog")->where(" parent_cat_id = '$cat_id' ")->find() && $data['level'] == 4 ) {
$this->sendError(10101,"该目录含有子目录,不允许转为底层目录。");
return;
}
$ret = D("Catalog")->where(" cat_id = '$cat_id' ")->save($data);
$return = D("Catalog")->where(" cat_id = '$cat_id' ")->find();
}else{
$data['addtime'] = time();
$cat_id = D("Catalog")->add($data);
$return = D("Catalog")->where(" cat_id = '$cat_id' ")->find();
}
if (!$return) {
$return['error_code'] = 10103 ;
$return['error_message'] = 'request fail' ;
}
$this->sendResult($return);
} | CWE-425 | 27 |
function scan_page($parent_id) {
global $db;
$sections = $db->selectObjects('section','parent=' . $parent_id);
$ret = '';
foreach ($sections as $page) {
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));
$ret .= scan_container($cLoc, $page->id);
$ret .= scan_page($page->id);
}
return $ret;
}
| CWE-89 | 0 |
private function getTaskLink()
{
$link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id'));
if (empty($link)) {
throw new PageNotFoundException();
}
return $link;
} | CWE-639 | 9 |
function update($vars, &$errors) {
if (!$vars['grace_period'])
$errors['grace_period'] = __('Grace period required');
elseif (!is_numeric($vars['grace_period']))
$errors['grace_period'] = __('Numeric value required (in hours)');
elseif ($vars['grace_period'] > 8760)
$errors['grace_period'] = sprintf(
__('%s cannot be more than 8760 hours'),
__('Grace period')
);
if (!$vars['name'])
$errors['name'] = __('Name is required');
elseif (($sid=SLA::getIdByName($vars['name'])) && $sid!=$vars['id'])
$errors['name'] = __('Name already exists');
if ($errors)
return false;
$this->name = $vars['name'];
$this->grace_period = $vars['grace_period'];
$this->notes = Format::sanitize($vars['notes']);
$this->flags =
($vars['isactive'] ? self::FLAG_ACTIVE : 0)
| (isset($vars['disable_overdue_alerts']) ? self::FLAG_NOALERTS : 0)
| (isset($vars['enable_priority_escalation']) ? self::FLAG_ESCALATE : 0)
| (isset($vars['transient']) ? self::FLAG_TRANSIENT : 0);
if ($this->save())
return true;
if (isset($this->id)) {
$errors['err']=sprintf(__('Unable to update %s.'), __('this SLA plan'))
.' '.__('Internal error occurred');
} else {
$errors['err']=sprintf(__('Unable to add %s.'), __('this SLA plan'))
.' '.__('Internal error occurred');
}
return false;
} | CWE-79 | 1 |
unset($return[$key]);
}
}
break;
}
return @array_change_key_case($return, CASE_UPPER);
} | CWE-79 | 1 |
public function Connected() {
if(!empty($this->smtp_conn)) {
$sock_status = socket_get_status($this->smtp_conn);
if($sock_status["eof"]) {
// the socket is valid but we are not connected
if($this->do_debug >= 1) {
$this->edebug("SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected");
}
$this->Close();
return false;
}
return true; // everything looks good
}
return false;
} | CWE-79 | 1 |
public static function error ($vars="") {
if( isset($vars) && $vars != "" ) {
include(GX_PATH.'/inc/lib/Control/Error/'.$vars.'.control.php');
}else{
include(GX_PATH.'/inc/lib/Control/Error/404.control.php');
}
} | CWE-79 | 1 |
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 |
public static function lang($vars) {
$file = GX_PATH.'/inc/lang/'.$vars.'.lang.php';
if (file_exists($file)) {
include($file);
}
}
| CWE-89 | 0 |
$this->paths[substr($key, strlen('path-'))] = $value;
}
| CWE-79 | 1 |
public static function rss() {
switch (SMART_URL) {
case true:
# code...
$inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":"";
$url = Site::$url.$inFold."/rss".GX_URL_PREFIX;
break;
default:
# code...
$url = Site::$url."/index.php?rss";
break;
}
return $url;
}
| CWE-89 | 0 |
public function setFlashCookieObject($name, $object, $time = 60)
{
setcookie($name, json_encode($object), time() + $time, '/');
return $this;
} | CWE-565 | 17 |
function edit_section() {
global $db, $user;
$parent = new section($this->params['parent']);
if (empty($parent->id)) $parent->id = 0;
assign_to_template(array(
'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0),
'parent' => $parent,
'isAdministrator' => $user->isAdmin(),
));
}
| 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 |
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && false ?: '_'}); | CWE-89 | 0 |
protected function gdImageBackground($image, $bgcolor){
if( $bgcolor == 'transparent' ){
imagesavealpha($image,true);
$bgcolor1 = imagecolorallocatealpha($image, 255, 255, 255, 127);
}else{
list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x");
$bgcolor1 = imagecolorallocate($image, $r, $g, $b);
}
imagefill($image, 0, 0, $bgcolor1);
} | CWE-89 | 0 |
public static function versionCheck() {
$v = trim(self::latestVersion());
// print_r($v);
if ($v > self::$version) {
Hooks::attach("admin_page_notif_action", array('System', 'versionReport'));
}
}
| CWE-89 | 0 |
public function Close() {
$this->error = null; // so there is no confusion
$this->helo_rply = null;
if(!empty($this->smtp_conn)) {
// close the connection and cleanup
fclose($this->smtp_conn);
$this->smtp_conn = 0;
}
} | CWE-79 | 1 |
$masteroption->delete();
}
// delete the mastergroup
$db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id);
$mastergroup->delete();
expHistory::back();
} | CWE-89 | 0 |
$this->assertEquals(array($flashes[$key]), $val);
++$i;
} | CWE-89 | 0 |
function remove() {
global $db;
$section = $db->selectObject('section', 'id=' . $this->params['id']);
if ($section) {
section::removeLevel($section->id);
$db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent);
$section->parent = -1;
$db->updateObject($section, 'section');
expSession::clearAllUsersSessionCache('navigation');
expHistory::back();
} else {
notfoundController::handle_not_authorized();
}
}
| CWE-89 | 0 |
public function close()
{
$this->active = false;
return (bool) $this->handler->close();
} | CWE-89 | 0 |
public function install(array $options = null, &$status=null)
{
parent::install($options);
parent::setup($options);
//check if ssl is enabled
$this->appcontext->run('v-list-web-domain', [$this->appcontext->user(), $this->domain, 'json'], $status);
$sslEnabled = ($status->json[$this->domain]['SSL'] == 'no' ? 0 : 1);
$webDomain = ($sslEnabled ? "https://" : "http://") . $this->domain . "/";
$this->appcontext->runUser('v-copy-fs-directory',[
$this->getDocRoot($this->extractsubdir . "/dokuwiki-release_stable_2020-07-29/."),
$this->getDocRoot()], $status);
// enable htaccess
$this->appcontext->runUser('v-move-fs-file', [$this->getDocRoot(".htaccess.dist"), $this->getDocRoot(".htaccess")], $status);
$installUrl = $webDomain . "install.php";
$cmd = "curl --request POST "
. ($sslEnabled ? "" : "--insecure " ) | CWE-78 | 6 |
function get_rsvpversion() {
return '9.2.5';
} | CWE-89 | 0 |