code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('SELECT * FROM nv_templates WHERE website = '.protect($website->id), 'object');
if($type='json')
$out = json_encode($DB->result());
return $out;
}
| CWE-89 | 0 |
function update_upcharge() {
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
//This will make sure that only the country or region that given a rate value will be saved in the db
$upcharge = array();
foreach($this->params['upcharge'] as $key => $item) {
if(!empty($item)) {
$upcharge[$key] = $item;
}
}
$this->config['upcharge'] = $upcharge;
$config->update(array('config'=>$this->config));
flash('message', gt('Configuration updated'));
expHistory::back();
} | CWE-89 | 0 |
$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 |
function manage() {
global $db;
expHistory::set('manageable', $this->params);
// $classes = array();
$dir = BASE."framework/modules/ecommerce/billingcalculators";
if (is_readable($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if (is_file("$dir/$file") && substr("$dir/$file", -4) == ".php") {
include_once("$dir/$file");
$classname = substr($file, 0, -4);
$id = $db->selectValue('billingcalculator', 'id', 'calculator_name="'.$classname.'"');
if (empty($id)) {
// $calobj = null;
$calcobj = new $classname();
if ($calcobj->isSelectable() == true) {
$obj = new billingcalculator(array(
'title'=>$calcobj->name(),
// 'user_title'=>$calcobj->title,
'body'=>$calcobj->description(),
'calculator_name'=>$classname,
'enabled'=>false));
$obj->save();
}
}
}
}
}
$bcalc = new billingcalculator();
$calculators = $bcalc->find('all');
assign_to_template(array(
'calculators'=>$calculators
));
} | 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 update()
{
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
$values = $this->request->getValues();
list($valid, $errors) = $this->tagValidator->validateModification($values);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($valid) {
if ($this->tagModel->update($values['id'], $values['name'])) {
$this->flash->success(t('Tag updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} else {
$this->edit($values, $errors);
}
} | CWE-639 | 9 |
public function Recipient($to) {
$this->error = null; // so no confusion is caused
if(!$this->connected()) {
$this->error = array(
"error" => "Called Recipient() without being connected");
return false;
}
fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
$rply = $this->get_lines();
$code = substr($rply,0,3);
if($this->do_debug >= 2) {
$this->edebug("SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />');
}
if($code != 250 && $code != 251) {
$this->error =
array("error" => "RCPT not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) {
$this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />');
}
return false;
}
return true;
} | CWE-79 | 1 |
function edit_order_item() {
$oi = new orderitem($this->params['id'], true, true);
if (empty($oi->id)) {
flash('error', gt('Order item doesn\'t exist.'));
expHistory::back();
}
$oi->user_input_fields = expUnserialize($oi->user_input_fields);
$params['options'] = $oi->opts;
$params['user_input_fields'] = $oi->user_input_fields;
$oi->product = new product($oi->product->id, true, true);
if ($oi->product->parent_id != 0) {
$parProd = new product($oi->product->parent_id);
//$oi->product->optiongroup = $parProd->optiongroup;
$oi->product = $parProd;
}
//FIXME we don't use selectedOpts?
// $oi->selectedOpts = array();
// if (!empty($oi->opts)) {
// foreach ($oi->opts as $opt) {
// $option = new option($opt[0]);
// $og = new optiongroup($option->optiongroup_id);
// if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id]))
// $oi->selectedOpts[$og->id] = array($option->id);
// else
// array_push($oi->selectedOpts[$og->id], $option->id);
// }
// }
//eDebug($oi->selectedOpts);
assign_to_template(array(
'oi' => $oi,
'params' => $params
));
} | CWE-89 | 0 |
function reset_stats() {
// global $db;
// reset the counters
// $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1');
banner::resetImpressions();
// $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1');
banner::resetClicks();
// let the user know we did stuff.
flash('message', gt("Banner statistics reset."));
expHistory::back();
} | CWE-89 | 0 |
public function attachLink(Request $request)
{
$pageId = $request->get('attachment_link_uploaded_to');
try {
$this->validate($request, [
'attachment_link_uploaded_to' => 'required|integer|exists:pages,id',
'attachment_link_name' => 'required|string|min:1|max:255',
'attachment_link_url' => 'required|string|min:1|max:255'
]);
} catch (ValidationException $exception) {
return response()->view('attachments.manager-link-form', array_merge($request->only(['attachment_link_name', 'attachment_link_url']), [
'pageId' => $pageId,
'errors' => new MessageBag($exception->errors()),
]), 422);
}
$page = $this->pageRepo->getById($pageId);
$this->checkPermission('attachment-create-all');
$this->checkOwnablePermission('page-update', $page);
$attachmentName = $request->get('attachment_link_name');
$link = $request->get('attachment_link_url');
$attachment = $this->attachmentService->saveNewFromLink($attachmentName, $link, $pageId);
return view('attachments.manager-link-form', [
'pageId' => $pageId,
]);
} | CWE-79 | 1 |
function VerifyFixedSchedule($columns,$columns_var,$update=false)
{
$qr_teachers= DBGet(DBQuery('select TEACHER_ID,SECONDARY_TEACHER_ID from course_periods where course_period_id=\''.$_REQUEST['course_period_id'].'\''));
$teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']:$qr_teachers[1]['TEACHER_ID']);
$secteacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']:$qr_teachers[1]['SECONDARY_TEACHER_ID']);
// $secteacher=$qr_teachers[1]['SECONDARY_TEACHER_ID'];
if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='')
$all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); | CWE-22 | 2 |
public function isMethodSafe()
{
return in_array($this->getMethod(), array('GET', 'HEAD'));
} | 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 static function getSName($zdb, $id, $wid = false, $wnick = false)
{
try {
$select = $zdb->select(self::TABLE);
$select->where(self::PK . ' = ' . $id);
$results = $zdb->execute($select);
$row = $results->current();
return self::getNameWithCase(
$row->nom_adh,
$row->prenom_adh,
false,
($wid === true ? $row->id_adh : false),
($wnick === true ? $row->pseudo_adh : false)
);
} catch (Throwable $e) {
Analog::log(
'Cannot get formatted name for member form id `' . $id . '` | ' .
$e->getMessage(),
Analog::WARNING
);
throw $e;
}
} | CWE-89 | 0 |
private function encloseForCSV($field)
{
return '"' . cleanCSV($field) . '"';
} | CWE-1236 | 12 |
public static function botlist() {
$botlist = array(
"Teoma",
"alexa",
"froogle",
"inktomi",
"looksmart",
"URL_Spider_SQL",
"Firefly",
"NationalDirectory",
"Ask Jeeves",
"TECNOSEEK",
"InfoSeek",
"WebFindBot",
"girafabot",
"crawler",
"www.galaxy.com",
"Googlebot",
"Scooter",
"Slurp",
"appie",
"FAST",
"WebBug",
"Spade",
"ZyBorg",
"rabaz",
"Twitterbot",
"MJ12bot",
"AhrefsBot",
"bingbot",
"YandexBot",
"spbot"
);
return $botlist;
}
| CWE-89 | 0 |
public function __construct(?string $message = null)
{
if ($message === null) {
$message = _('Invalid email/password combination.');
}
parent::__construct($message, 0);
} | CWE-307 | 26 |
function html_operation_successful( $p_redirect_url, $p_message = '' ) {
echo '<div class="success-msg">';
if( !is_blank( $p_message ) ) {
echo $p_message . '<br />';
}
echo lang_get( 'operation_successful' ).'<br />';
print_bracket_link( $p_redirect_url, lang_get( 'proceed' ) );
echo '</div>';
} | 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 |
public static function getId($id=''){
if(isset($id)){
$sql = sprintf("SELECT * FROM `menus` WHERE `id` = '%d' ORDER BY `order` ASC", $id);
$menus = Db::result($sql);
$n = Db::$num_rows;
}else{
$menus = '';
}
return $menus;
} | CWE-79 | 1 |
public function testGetEventsPublicProfile(){
TestingAuxLib::loadX2NonWebUser ();
TestingAuxLib::suLogin ('testuser');
Yii::app()->settings->historyPrivacy = null;
$lastEventId=0;
$lastTimestamp=0;
$myProfile = Profile::model()->findByAttributes(array('username' => 'testuser2'));
$events=Events::getEvents(
$lastEventId,$lastTimestamp,null,$myProfile, false);
$this->assertEquals (
array_map (
function ($event) { return $event->id; },
Events::model ()->findAllByAttributes (array (
'user' => 'testuser2',
'visibility' => 1
))
),
array_map (function ($event) { return $event->id; }, $events['events']));
TestingAuxLib::restoreX2WebUser ();
} | CWE-79 | 1 |
protected function deleteFileInStorage(Attachment $attachment)
{
$storage = $this->getStorage();
$dirPath = dirname($attachment->path);
$storage->delete($attachment->path);
if (count($storage->allFiles($dirPath)) === 0) {
$storage->deleteDirectory($dirPath);
}
} | CWE-22 | 2 |
public function getQuerySelect()
{
return '';
} | CWE-89 | 0 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$category = $this->getCategory();
if ($this->categoryModel->remove($category['id'])) {
$this->flash->success(t('Category removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this category.'));
}
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
function update_option_master() {
global $db;
$id = empty($this->params['id']) ? null : $this->params['id'];
$opt = new option_master($id);
$oldtitle = $opt->title;
$opt->update($this->params);
// if the title of the master changed we should update the option groups that are already using it.
if ($oldtitle != $opt->title) {
}$db->sql('UPDATE '.$db->prefix.'option SET title="'.$opt->title.'" WHERE option_master_id='.$opt->id);
expHistory::back();
} | CWE-89 | 0 |
function edit_vendor() {
$vendor = new vendor();
if(isset($this->params['id'])) {
$vendor = $vendor->find('first', 'id =' .$this->params['id']);
assign_to_template(array(
'vendor'=>$vendor
));
}
} | CWE-89 | 0 |
public function start()
{
if ($this->started) {
return true;
}
$this->loadSession();
if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) {
// This condition matches only PHP 5.3 + internal save handlers
$this->saveHandler->setActive(true);
}
return true;
} | CWE-89 | 0 |
public static function editor($mode = 'light'){
$editor = Options::v('use_editor');
if($editor == 'on'){
$GLOBALS['editor'] = true;
}else{
$GLOBALS['editor'] = false;
}
if ($mode == 'light') {
$GLOBALS['editor_mode'] = 'light';
}else{
$GLOBALS['editor_mode'] = 'full';
}
//return $editor;
}
| CWE-89 | 0 |
public function testGetEvents(){
TestingAuxLib::loadX2NonWebUser ();
TestingAuxLib::suLogin ('admin');
Yii::app()->settings->historyPrivacy = null;
$lastEventId = 0;
$lastTimestamp = 0;
$events = Events::getEvents ($lastEventId, $lastTimestamp, 4);
$this->assertEquals (
Yii::app()->db->createCommand (
"select id from x2_events order by timestamp desc, id desc limit 4")
->queryColumn (),
array_map(function ($event) { return $event->id; }, $events['events'])
);
TestingAuxLib::restoreX2WebUser ();
} | CWE-79 | 1 |
public function testComments()
{
$antiXss = new \MicroweberPackages\Helper\HTMLClean();
$string = '<a href="https://example.com">test</a>';
$content = $antiXss->onlyTags($string);
$this->assertEquals($string, $content);
} | CWE-79 | 1 |
public static function returnChildrenAsJSON() {
global $db;
//$nav = section::levelTemplate(intval($_REQUEST['id'], 0));
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$nav = $db->selectObjects('section', 'parent=' . $id, 'rank');
//FIXME $manage_all is moot w/ cascading perms now?
$manage_all = false;
if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) {
$manage_all = true;
}
//FIXME recode to use foreach $key=>$value
$navcount = count($nav);
for ($i = 0; $i < $navcount; $i++) {
if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) {
$nav[$i]->manage = 1;
$view = true;
} else {
$nav[$i]->manage = 0;
$view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id));
}
$nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name);
if (!$view) unset($nav[$i]);
}
$nav= array_values($nav);
// $nav[$navcount - 1]->last = true;
if (count($nav)) $nav[count($nav) - 1]->last = true;
// echo expJavascript::ajaxReply(201, '', $nav);
$ar = new expAjaxReply(201, '', $nav);
$ar->send();
}
| CWE-89 | 0 |
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {
if ($is_revisioned) {
$object->revision_id++;
//if ($table=="text") eDebug($object);
$res = $this->insertObject($object, $table);
//if ($table=="text") eDebug($object,true);
$this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);
return $res;
}
$sql = "UPDATE " . $this->prefix . "$table SET ";
foreach (get_object_vars($object) as $var => $val) {
//We do not want to save any fields that start with an '_'
//if($is_revisioned && $var=='revision_id') $val++;
if ($var{0} != '_') {
if (is_array($val) || is_object($val)) {
$val = serialize($val);
$sql .= "`$var`='".$val."',";
} else {
$sql .= "`$var`='" . $this->escapeString($val) . "',";
}
}
}
$sql = substr($sql, 0, -1) . " WHERE ";
if ($where != null)
$sql .= $this->injectProof($where);
else
$sql .= "`" . $identifier . "`=" . $object->$identifier;
//if ($table == 'text') eDebug($sql,true);
$res = (@mysqli_query($this->connection, $sql) != false);
return $res;
} | CWE-89 | 0 |
foreach ($day as $extevent) {
$event_cache = new stdClass();
$event_cache->feed = $extgcalurl;
$event_cache->event_id = $extevent->event_id;
$event_cache->title = $extevent->title;
$event_cache->body = $extevent->body;
$event_cache->eventdate = $extevent->eventdate->date;
if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400)
$event_cache->dateFinished = $extevent->dateFinished;
if (isset($extevent->eventstart))
$event_cache->eventstart = $extevent->eventstart;
if (isset($extevent->eventend))
$event_cache->eventend = $extevent->eventend;
if (isset($extevent->is_allday))
$event_cache->is_allday = $extevent->is_allday;
$found = false;
if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries
$found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate);
if (!$found)
$db->insertObject($event_cache,'event_cache');
}
| CWE-89 | 0 |
function &getAll(&$dbh, $proposalId)
{
$sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS timestamp FROM package_proposal_votes WHERE pkg_prop_id = ". $dbh->quoteSmart($proposalId) ." ORDER BY timestamp ASC";
$res = $dbh->query($sql);
if (DB::isError($res)) {
return $res;
}
$votes = array();
while ($set = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$set['reviews'] = unserialize($set['reviews']);
$votes[$set['user_handle']] = new ppVote($set);
}
return $votes;
} | CWE-502 | 15 |
public function downloadfile() {
if (empty($this->params['fileid'])) {
flash('error', gt('There was an error while trying to download your file. No File Specified.'));
expHistory::back();
}
$fd = new filedownload($this->params['fileid']);
if (empty($this->params['filenum'])) $this->params['filenum'] = 0;
if (empty($fd->expFile['downloadable'][$this->params['filenum']]->id)) {
flash('error', gt('There was an error while trying to download your file. The file you were looking for could not be found.'));
expHistory::back();
}
$fd->downloads++;
$fd->save();
// this will set the id to the id of the actual file..makes the download go right.
$this->params['id'] = $fd->expFile['downloadable'][$this->params['filenum']]->id;
parent::downloadfile();
} | CWE-89 | 0 |
function update_optiongroup_master() {
global $db;
$id = empty($this->params['id']) ? null : $this->params['id'];
$og = new optiongroup_master($id);
$oldtitle = $og->title;
$og->update($this->params);
// if the title of the master changed we should update the option groups that are already using it.
if ($oldtitle != $og->title) {
$db->sql('UPDATE '.$db->prefix.'optiongroup SET title="'.$og->title.'" WHERE title="'.$oldtitle.'"');
}
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 |
function update_vendor() {
$vendor = new vendor();
$vendor->update($this->params['vendor']);
expHistory::back();
} | CWE-89 | 0 |
function verify(){
echo $_GET['challenge'];
} | CWE-79 | 1 |
function info_application($bp_name, $bdd){
$sql = "select * from bp where name = '" . $bp_name . "'";
$req = $bdd->query($sql);
$info = $req->fetch();
echo json_encode($info);
} | CWE-78 | 6 |
protected function _joinPath($dir, $name)
{
return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
} | CWE-78 | 6 |
function searchCategory() {
return gt('Event');
}
| CWE-89 | 0 |
public function setModel(Model $model)
{
$this->model = $model;
$this->extensions = $this->model->getAllowedExtensions();
$this->from($this->model->getObjectTypeDirName());
return $this;
} | CWE-79 | 1 |
public function attributeLabels() {
return array(
'actionId' => Yii::t('actions','Action ID'),
'text' => Yii::t('actions','Action Text'),
);
} | CWE-79 | 1 |
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql);
foreach ($evs as $key=>$event) {
if ($condense) {
$eventid = $event->id;
$multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;'));
if (!empty($multiday_event)) {
unset($evs[$key]);
continue;
}
}
$evs[$key]->eventstart += $edate->date;
$evs[$key]->eventend += $edate->date;
$evs[$key]->date_id = $edate->id;
if (!empty($event->expCat)) {
$catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color);
// if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';';
$evs[$key]->color = $catcolor;
}
}
if (count($events) < 500) { // magic number to not crash loop?
$events = array_merge($events, $evs);
} else {
// $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!');
// $events = array_merge($events, $evs);
flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'));
break; // keep from breaking system by too much data
}
}
| CWE-89 | 0 |
public function getQuerySelect()
{
// SubmittedOn is stored in the artifact
return "a.submitted_by AS `" . $this->name . "`";
} | CWE-89 | 0 |
public function load_from_resultset($rs)
{
global $DB;
$main = $rs[0];
$this->id = $main->id;
$this->codename = $main->codename;
$this->icon = $main->icon;
$this->lid = $main->lid;
$this->notes = $main->notes;
$this->enabled = $main->enabled;
/*
$DB->query('SELECT function_id
FROM nv_menu_items
WHERE menu_id = '.$this->id.' ORDER BY position ASC');
$this->functions = $DB->result('function_id');
*/
$this->functions = json_decode($main->functions);
if(empty($this->functions)) $this->functions = array();
}
| CWE-79 | 1 |
public function update_discount() {
$id = empty($this->params['id']) ? null : $this->params['id'];
$discount = new discounts($id);
// find required shipping method if needed
if ($this->params['required_shipping_calculator_id'] > 0) {
$this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']];
} else {
$this->params['required_shipping_calculator_id'] = 0;
}
$discount->update($this->params);
expHistory::back();
} | CWE-89 | 0 |
public function withPath($path)
{
if (!is_string($path)) {
throw new \InvalidArgumentException(
'Invalid path provided; must be a string'
);
}
$path = $this->filterPath($path);
if ($this->path === $path) {
return $this;
}
$new = clone $this;
$new->path = $path;
return $new;
} | CWE-89 | 0 |
public function AbbreviateHash($project, $hash)
{
if (!$project)
return $hash;
if (!(preg_match('/[0-9A-Fa-f]{40}/', $hash))) {
return $hash;
}
$args = array();
$args[] = '-1';
$args[] = '--format=format:%h';
$args[] = $hash;
$abbrevData = explode("\n", $this->exe->Execute($project->GetPath(), GIT_REV_LIST, $args));
if (empty($abbrevData[0])) {
return $hash;
}
if (substr_compare(trim($abbrevData[0]), 'commit', 0, 6) !== 0) {
return $hash;
}
if (empty($abbrevData[1])) {
return $hash;
}
return trim($abbrevData[1]);
} | CWE-78 | 6 |
function json_decode($json, $assoc=null)
{
return array();
} | CWE-918 | 16 |
$_fn[] = self::buildCondition($v, ' && ');
}
$fn[] = '('.\implode(' || ', $_fn).')';
break;
case '$where':
if (\is_callable($value)) {
// need implementation
}
break;
default:
$d = '$document';
if (\strpos($key, '.') !== false) {
$keys = \explode('.', $key);
foreach ($keys as $k) {
$d .= '[\''.$k.'\']';
}
} else {
$d .= '[\''.$key.'\']';
}
if (\is_array($value)) {
$fn[] = "\\MongoLite\\UtilArrayQuery::check((isset({$d}) ? {$d} : null), ".\var_export($value, true).')';
} else {
if (is_null($value)) {
$fn[] = "(!isset({$d}))";
} else {
$_value = \var_export($value, true);
$fn[] = "(isset({$d}) && (
is_array({$d}) && is_string({$_value})
? in_array({$_value}, {$d})
: {$d}=={$_value}
)
)";
}
}
}
}
return \count($fn) ? \trim(\implode($concat, $fn)) : 'true';
} | CWE-89 | 0 |
$logo = "<img src=\"".Options::get('siteurl').Options::get('logo')."\"
style=\"width: $width; height: $height; margin: 1px;\">";
}else{
$logo = "<span class=\"mg genixcms-logo\"></span>";
}
return $logo;
} | CWE-79 | 1 |
foreach($functions as $function)
{
if($function->id == $f)
{
if($function->enabled=='1')
$sortable_assigned[] = '<li class="ui-state-highlight" value="'.$function->id.'" category="'.$function->category.'"><img src="'.NAVIGATE_URL.'/'.$function->icon.'" align="absmiddle" /> '.t($function->lid, $function->lid).'</li>';
else
$sortable_assigned[] = '<li class="ui-state-highlight ui-state-disabled" value="'.$function->id.'" category="'.$function->category.'"><img src="'.NAVIGATE_URL.'/'.$function->icon.'" align="absmiddle" /> '.t($function->lid, $function->lid).'</li>';
}
}
| CWE-79 | 1 |
function PMA_getErrorReportForm()
{
$html = "";
$html .= '<form action="error_report.php" method="post" name="report_frm"'
. ' id="report_frm" class="ajax">'
. '<fieldset style="padding-top:0px">';
$html .= '<p>' . __(
'phpMyAdmin has encountered an error. We have collected data about'
. ' this error as well as information about relevant configuration'
. ' settings to send to the phpMyAdmin team to help us in'
. ' debugging the problem.'
) . '</p>';
$html .= '<div class="label"><label><p>'
. __('You may examine the data in the error report:')
. '</p></label></div>'
. '<pre class="report-data">'
. PMA_getReportData()
. '</pre>';
$html .= '<div class="label"><label><p>'
. __('Please explain the steps that lead to the error:')
. '</p></label></div>'
. '<textarea class="report-description" name="description"'
. 'id="report_description"></textarea>';
$html .= '<input type="checkbox" name="always_send"'
. ' id="always_send_checkbox"/>'
. '<label for="always_send_checkbox">'
. __('Automatically send report next time')
. '</label>';
$html .= '</fieldset>';
$html .= PMA_URL_getHiddenInputs();
$reportData = PMA_getReportData(false);
if (! empty($reportData)) {
$html .= PMA_getHiddenFields($reportData);
}
$html .= '</form>';
return $html;
} | CWE-79 | 1 |
public function confirm()
{
$project = $this->getProject();
$swimlane = $this->getSwimlane();
$this->response->html($this->helper->layout->project('swimlane/remove', array(
'project' => $project,
'swimlane' => $swimlane,
)));
} | CWE-639 | 9 |
function move_standalone() {
expSession::clearAllUsersSessionCache('navigation');
assign_to_template(array(
'parent' => $this->params['parent'],
));
}
| CWE-89 | 0 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->checkPermission($project, $filter);
if ($this->customFilterModel->remove($filter['id'])) {
$this->flash->success(t('Custom filter removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this custom filter.'));
}
$this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public function 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 |
protected function _joinPath($dir, $name)
{
return rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name;
} | CWE-918 | 16 |
function nvweb_menu_load_actions()
{
global $DB;
global $structure;
global $current;
global $website;
if(empty($structure['actions']))
{
$structure['actions'] = array();
$DB->query('
SELECT node_id, subtype, text
FROM nv_webdictionary
WHERE node_type = "structure"
AND lang = '.protect($current['lang']).'
AND subtype IN("action-type", "action-jump-item", "action-jump-branch", "action-new-window")
AND website = '.$website->id
);
$data = $DB->result();
if(!is_array($data))
$data = array();
foreach($data as $row)
{
$structure['actions'][$row->node_id][$row->subtype] = $row->text;
}
}
}
| CWE-89 | 0 |
function scan_page($parent_id) {
global $db;
$sections = $db->selectObjects('section','parent=' . $parent_id);
$ret = '';
foreach ($sections as $page) {
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));
$ret .= scan_container($cLoc, $page->id);
$ret .= scan_page($page->id);
}
return $ret;
}
| CWE-89 | 0 |
public function uploadAvatar(Request $request)
{
$user = auth()->user();
if ($user && $request->hasFile('admin_avatar')) {
$user->clearMediaCollection('admin_avatar');
$user->addMediaFromRequest('admin_avatar')
->toMediaCollection('admin_avatar');
}
if ($user && $request->has('avatar')) {
$data = json_decode($request->avatar);
$user->clearMediaCollection('admin_avatar');
$user->addMediaFromBase64($data->data)
->usingFileName($data->name)
->toMediaCollection('admin_avatar');
}
return new UserResource($user);
} | 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 |
function send_feedback() {
$success = false;
if (isset($this->params['id'])) {
$ed = new eventdate($this->params['id']);
// $email_addrs = array();
if ($ed->event->feedback_email != '') {
$msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . $this->params['formname'], $this->loc);
$msgtemplate->assign('params', $this->params);
$msgtemplate->assign('event', $ed);
$email_addrs = explode(',', $ed->event->feedback_email);
//This is an easy way to remove duplicates
$email_addrs = array_flip(array_flip($email_addrs));
$email_addrs = array_map('trim', $email_addrs);
$mail = new expMail();
$success += $mail->quickSend(array(
"text_message" => $msgtemplate->render(),
'to' => $email_addrs,
'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS),
'subject' => $this->params['subject'],
));
}
}
if ($success) {
flashAndFlow('message', gt('Your feedback was successfully sent.'));
} else {
flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.'));
}
}
| CWE-89 | 0 |
public function update()
{
global $DB;
$ok = $DB->execute('
UPDATE nv_menus
SET codename = :codename, icon = :icon, lid = :lid, notes = :notes,
functions = :functions, enabled = :enabled
WHERE id = :id',
array(
'id' => $this->id,
'codename' => value_or_default($this->codename, ""),
'icon' => value_or_default($this->icon, ""),
'lid' => value_or_default($this->lid, 0),
'notes' => value_or_default($this->notes, ""),
'functions' => json_encode($this->functions),
'enabled' => value_or_default($this->enabled, 0)
)
);
if(!$ok)
throw new Exception($DB->get_last_error());
return true;
}
| CWE-79 | 1 |
public function saveConfig() {
if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) {
if ($this->params['order'] == 'rank ASC') {
expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params);
}
}
parent::saveConfig();
} | CWE-89 | 0 |
$sloc = expCore::makeLocation('navigation', null, $section->id);
// remove any manage permissions for this page and it's children
// $db->delete('userpermission', "module='navigationController' AND internal=".$section->id);
// $db->delete('grouppermission', "module='navigationController' AND internal=".$section->id);
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
}
}
| CWE-89 | 0 |
function select_string($n) {
if (!is_int($n)) {
throw new InvalidArgumentException(
"Select_string only accepts integers: " . $n);
}
$string = $this->get_plural_forms();
$string = str_replace('nplurals',"\$total",$string);
$string = str_replace("n",$n,$string);
$string = str_replace('plural',"\$plural",$string);
$total = 0;
$plural = 0;
eval("$string");
if ($plural >= $total) $plural = $total - 1;
return $plural;
} | CWE-94 | 14 |
function update_optiongroup_master() {
global $db;
$id = empty($this->params['id']) ? null : $this->params['id'];
$og = new optiongroup_master($id);
$oldtitle = $og->title;
$og->update($this->params);
// if the title of the master changed we should update the option groups that are already using it.
if ($oldtitle != $og->title) {
$db->sql('UPDATE '.$db->prefix.'optiongroup SET title="'.$og->title.'" WHERE title="'.$oldtitle.'"');
}
expHistory::back();
} | CWE-89 | 0 |
public static function update_object_score($object, $object_id)
{
global $DB;
list($votes, $score) = webuser_vote::calculate_object_score($object, $object_id);
$table = array(
'item' => 'nv_items',
'structure' => 'nv_structure',
'product' => 'nv_products'
);
if(empty($table[$object]))
return false;
$DB->execute('
UPDATE '.$table[$object].'
SET votes = '.protect($votes).',
score = '.protect($score).'
WHERE id = '.protect($object_id)
);
return true;
}
| CWE-89 | 0 |
$files[$key]->save();
}
// eDebug($files,true);
} | CWE-89 | 0 |
function db_case($array)
{
global $DatabaseType;
$counter = 0;
if ($DatabaseType == 'mysqli') {
$array_count = count($array);
$string = " CASE WHEN $array[0] =";
$counter++;
$arr_count = count($array);
for ($i = 1; $i < $arr_count; $i++) {
$value = $array[$i];
if ($value == "''" && substr($string, -1) == '=') {
$value = ' IS NULL';
$string = substr($string, 0, -1);
}
$string .= "$value";
if ($counter == ($array_count - 2) && $array_count % 2 == 0)
$string .= " ELSE ";
elseif ($counter == ($array_count - 1))
$string .= " END ";
elseif ($counter % 2 == 0)
$string .= " WHEN $array[0]=";
elseif ($counter % 2 == 1)
$string .= " THEN ";
$counter++;
}
}
return $string;
} | CWE-22 | 2 |
}elseif($p->group == 3){
$grp = AUTHOR;
}elseif($p->group == 4){
| CWE-89 | 0 |
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 evaluate_search_tree($tree, $join = 'AND', $callback)
{
$matches = false;
foreach($tree as $i => $el)
{
$b = false;
if($i === 'AND' || $i === 'OR')
{
$b = self::evaluate_search_tree($el, $i, $callback);
}
else if(isset($el['query']))
{
$b = call_user_func($callback, $el['query']);
if($el['not'])
{
$b = !$b;
}
}
else if(is_array($el))
{
$b = self::evaluate_search_tree($el, $join, $callback);
}
if($join == 'AND')
{
if(!$b)
{
return false;
}
$matches = true;
}
else if($join == 'OR')
{
if($b)
{
return true;
}
$matches = $matches || $b;
}
}
return $matches;
} | CWE-79 | 1 |
protected function defaultExtensions()
{
return [
'jpg',
'jpeg',
'bmp',
'png',
'webp',
'gif',
'svg',
'js',
'map',
'ico',
'css',
'less',
'scss',
'ics',
'odt',
'doc',
'docx',
'ppt',
'pptx',
'pdf',
'swf',
'txt',
'xml',
'ods',
'xls',
'xlsx',
'eot',
'woff',
'woff2',
'ttf',
'flv',
'wmv',
'mp3',
'ogg',
'wav',
'avi',
'mov',
'mp4',
'mpeg',
'webm',
'mkv',
'rar',
'xml',
'zip'
];
} | CWE-22 | 2 |
function singleQuoteReplace($param1 = false, $param2 = false, $param3)
{
return str_replace("'", "''", str_replace("\'", "'", $param3));
} | CWE-79 | 1 |
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 |
self::$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
return self::$mysqli;
}
} | CWE-89 | 0 |
public function showUnpublished() {
expHistory::set('viewable', $this->params);
// setup the where clause for looking up records.
$where = parent::aggregateWhereClause();
$where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where;
if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1';
$page = new expPaginator(array(
'model'=>'news',
'where'=>$where,
'limit'=>25,
'order'=>'unpublish',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title',
gt('Published On')=>'publish',
gt('Status')=>'unpublish'
),
));
assign_to_template(array(
'page'=>$page
));
} | CWE-89 | 0 |
public function dump($value)
{
$dumper = $this->getDumper();
if ($dumper) {
// re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump.
// exclude verbose information (e.g. exception stack traces)
if (class_exists('Symfony\Component\VarDumper\Caster\Caster')) {
$cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE);
// Symfony VarDumper 2.6 Caster class dont exist.
} else {
$cloneVar = $this->getCloner()->cloneVar($value);
}
$dumper->dump(
$cloneVar,
$this->htmlDumperOutput
);
$output = $this->htmlDumperOutput->getOutput();
$this->htmlDumperOutput->clear();
return $output;
}
return print_r($value, true);
} | CWE-79 | 1 |
function HackingLog()
{
echo "" . _youReNotAllowedToUseThisProgram . "! " . _thisAttemptedViolationHasBeenLoggedAndYourIpAddressWasCaptured . ".";
Warehouse('footer');
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
if ($openSISNotifyAddress)
mail($openSISNotifyAddress, 'HACKING ATTEMPT', "INSERT INTO hacking_log (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('$_SERVER[SERVER_NAME]','$ip','" . date('Y-m-d') . "','$openSISVersion','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]','$_REQUEST[modname]','" . User('USERNAME') . "')");
if (false && function_exists('query')) {
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$connection = new mysqli('os4ed.com', 'openSIS_log', 'openSIS_log', 'openSIS_log');
$connection->query("INSERT INTO hacking_log (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('$_SERVER[SERVER_NAME]','$ip','" . date('Y-m-d') . "','$openSISVersion','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]','" . optional_param('modname', '', PARAM_CLEAN) . "','" . User('USERNAME') . "')");
mysqli_close($link);
}
} | CWE-22 | 2 |
public function getQueryGroupby()
{
return '';
} | CWE-89 | 0 |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| CWE-89 | 0 |
public function approve() {
expHistory::set('editable', $this->params);
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
$comment = new expComment($this->params['id']);
assign_to_template(array(
'comment'=>$comment
));
} | CWE-89 | 0 |
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 |
$contents = ['form' => tep_draw_form('specials', 'specials.php', 'page=' . $_GET['page'] . '&sID=' . $sInfo->specials_id . '&action=deleteconfirm')]; | CWE-79 | 1 |
public function destroy($id)
{
$sql = 'DELETE FROM plugin_hudson_widget WHERE id = ' . $id . ' AND owner_id = ' . $this->owner_id . " AND owner_type = '" . $this->owner_type . "'";
db_query($sql);
} | CWE-89 | 0 |
public static function activate($thm) {
if (Options::update('themes', $thm)) {
new Options();
return true;
}else{
return false;
}
}
| CWE-89 | 0 |
function sell_media_ecommerce_enabled( $post_id ) {
$status = true;
$meta = get_post_meta( $post_id, 'sell_media_enable_ecommerce', true );
if ( class_exists( 'VS_Platform' ) && 0 === $meta ) {
$status = false;
}
return $status;
} | CWE-79 | 1 |
public function approve_toggle() {
if (empty($this->params['id'])) return;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
$comment = new expComment($this->params['id']);
$comment->approved = $comment->approved == 1 ? 0 : 1;
if ($comment->approved) {
$this->sendApprovalNotification($comment,$this->params);
}
$comment->save();
expHistory::back();
} | CWE-89 | 0 |
foreach ($allowedFolders as $folder) {
if ('/' . $folder === substr($uri, 0, 1 + strlen($folder))) {
header('Content-Type: ' . $this->getMime($filePath));
readfile($filePath);
return true;
}
} | CWE-79 | 1 |
throw new \InvalidArgumentException(
'URI must be a string or Psr\Http\Message\UriInterface'
);
}
$this->method = strtoupper($method);
$this->uri = $uri;
$this->setHeaders($headers);
$this->protocol = $protocolVersion;
$host = $uri->getHost();
if ($host && !$this->hasHeader('Host')) {
$this->updateHostFromUri($host);
}
if ($body) {
$this->stream = stream_for($body);
}
} | CWE-89 | 0 |
public function post_prop () {
$file = urldecode (join ('/', func_get_args ()));
if (! FileManager::verify_file ($file)) {
return $this->error (__ ('Invalid file name'));
}
// handle multiple properties at once
if (isset ($_POST['props'])) {
if (! is_array ($_POST['props'])) {
return $this->error (__ ('Invalid properties'));
}
foreach ($_POST['props'] as $k => $v) {
if (FileManager::prop ($file, $k, $v) === false) {
return $this->error (__ ('Error saving properties.'));
}
}
return array (
'file' => $file,
'props' => $_POST['props'],
'msg' => __ ('Properties saved.')
);
}
// handle a single property
if (! isset ($_POST['prop'])) {
return $this->error (__ ('Missing property name'));
}
if (isset ($_POST['value'])) {
// update and fetch
$res = FileManager::prop ($file, $_POST['prop'], $_POST['value']);
} else {
// fetch
$res = FileManager::prop ($file, $_POST['prop']);
}
return array (
'file' => $file,
'prop' => $_POST['prop'],
'value' => $res,
'msg' => __ ('Properties saved.')
);
} | CWE-434 | 5 |
protected function _add_log_attachment( $action, $attachment_id ) {
$post = get_post( $attachment_id );
aal_insert_log( array(
'action' => $action,
'object_type' => 'Attachment',
'object_subtype' => $post->post_type,
'object_id' => $attachment_id,
'object_name' => get_the_title( $post->ID ),
) );
} | CWE-79 | 1 |
$tags = array_merge($matches[1], $tags);
}
$tags = array_unique($tags);
return $tags;
} | CWE-79 | 1 |
function db_case($array)
{
global $DatabaseType;
$counter = 0;
if ($DatabaseType == 'mysqli') {
$array_count = count($array);
$string = " CASE WHEN $array[0] =";
$counter++;
$arr_count = count($array);
for ($i = 1; $i < $arr_count; $i++) {
$value = $array[$i];
if ($value == "''" && substr($string, -1) == '=') {
$value = ' IS NULL';
$string = substr($string, 0, -1);
}
$string .= "$value";
if ($counter == ($array_count - 2) && $array_count % 2 == 0)
$string .= " ELSE ";
elseif ($counter == ($array_count - 1))
$string .= " END ";
elseif ($counter % 2 == 0)
$string .= " WHEN $array[0]=";
elseif ($counter % 2 == 1)
$string .= " THEN ";
$counter++;
}
}
return $string;
} | CWE-22 | 2 |
protected function redirectToGroup(Thread $thread, $group_id)
{
if ($thread->state != Thread::STATE_CHATTING) {
// We can redirect only threads which are in proggress now.
return false;
}
// Redirect the thread
$thread->state = Thread::STATE_WAITING;
$thread->nextAgent = 0;
$thread->groupId = $group_id;
$thread->agentId = 0;
$thread->agentName = '';
$thread->save();
// Send notification message
$thread->postMessage(
Thread::KIND_EVENTS,
getlocal(
'Operator {0} redirected you to another operator. Please wait a while.',
array(get_operator_name($this->getOperator())),
$thread->locale,
true
)
);
return true;
} | CWE-79 | 1 |
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
| CWE-89 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.