code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
function delete_recurring() {
$item = $this->event->find('first', 'id=' . $this->params['id']);
if ($item->is_recurring == 1) { // need to give user options
expHistory::set('editable', $this->params);
assign_to_template(array(
'checked_date' => $this->params['date_id'],
'event' => $item,
));
} else { // Process a regular delete
$item->delete();
}
}
| CWE-89 | 0 |
$that->assertGreaterThanOrEqual(time() - 1, $criteria[$that->options['expiry_field']]['$lt']->sec);
})); | CWE-89 | 0 |
protected function secure(Hostname $hostname, Request $request)
{
$this->emitEvent(new Secured($hostname));
return $this->redirect->secure($request->getRequestUri());
} | CWE-601 | 11 |
foreach ($value as $k => $val) {
if ($k != 'LAST_UPDATED') {
if ($k != 'UPDATED_BY') {
if ($k == 'ID')
$data['data'][$i]['SCHOOL_ID'] = $val;
else if ($k == 'SYEAR')
$data['data'][$i]['SCHOOL_YEAR'] = $val;
else if ($k == 'TITLE')
$data['data'][$i]['SCHOOL_NAME'] = $val;
else if ($k == 'WWW_ADDRESS')
$data['data'][$i]['URL'] = $val;
else
$data['data'][$i][$k] = $val;
}
}
} | CWE-22 | 2 |
public static function totalCat($vars) {
$posts = Db::result("SELECT `id` FROM `cat` WHERE `type` = '{$vars}'");
$npost = Db::$num_rows;
return $npost;
}
| 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 |
public function update() {
//populate the alt tag field if the user didn't
if (empty($this->params['alt'])) $this->params['alt'] = $this->params['title'];
// call expController update to save the image
parent::update();
} | CWE-89 | 0 |
foreach($course_RET as $period_day)
{
$period_days_append_sql .="(sp.start_time<='$period_day[END_TIME]' AND '$period_day[START_TIME]'<=sp.end_time AND DAYS LIKE '%$period_day[DAYS]%') OR ";
} | CWE-79 | 1 |
$section = new section($this->params);
} else {
notfoundController::handle_not_found();
exit;
}
if (!empty($section->id)) {
$check_id = $section->id;
} else {
$check_id = $section->parent;
}
if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) {
if (empty($section->id)) {
$section->active = 1;
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
} else { // User does not have permission to manage sections. Throw a 403
notfoundController::handle_not_authorized();
}
}
| CWE-89 | 0 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$action = $this->actionModel->getById($this->request->getIntegerParam('action_id'));
if (! empty($action) && $this->actionModel->remove($action['id'])) {
$this->flash->success(t('Action removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this action.'));
}
$this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public static function inc ($vars, $data = "") {
$file = GX_PATH.'/gxadmin/inc/'.$vars.'.php';
if (file_exists($file)) {
include($file);
}
}
| CWE-89 | 0 |
$result = $search->getSearchResults($item->query, false, true);
if(empty($result) && !in_array($item->query, $badSearchArr)) {
$badSearchArr[] = $item->query;
$badSearch[$ctr2]['query'] = $item->query;
$badSearch[$ctr2]['count'] = $db->countObjects("search_queries", "query='{$item->query}'");
$ctr2++;
}
}
//Check if the user choose from the dropdown
if(!empty($user_default)) {
if($user_default == $anonymous) {
$u_id = 0;
} else {
$u_id = $user_default;
}
$where .= "user_id = {$u_id}";
}
//Get all the search query records
$records = $db->selectObjects('search_queries', $where);
for ($i = 0, $iMax = count($records); $i < $iMax; $i++) {
if(!empty($records[$i]->user_id)) {
$u = user::getUserById($records[$i]->user_id);
$records[$i]->user = $u->firstname . ' ' . $u->lastname;
}
}
$page = new expPaginator(array(
'records' => $records,
'where'=>1,
'model'=>'search_queries',
'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? 10 : $this->config['limit'],
'order'=>empty($this->config['order']) ? 'timestamp' : $this->config['order'],
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'columns'=>array(
'ID'=>'id',
gt('Query')=>'query',
gt('Timestamp')=>'timestamp',
gt('User')=>'user_id',
),
));
$uname['id'] = implode($uname['id'],',');
$uname['name'] = implode($uname['name'],',');
assign_to_template(array(
'page'=>$page,
'users'=>$uname,
'user_default' => $user_default,
'badSearch' => $badSearch
));
} | CWE-89 | 0 |
protected function AddAnAddress($kind, $address, $name = '') {
if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
$this->SetError($this->Lang('Invalid recipient array').': '.$kind);
if ($this->exceptions) {
throw new phpmailerException('Invalid recipient array: ' . $kind);
}
if ($this->SMTPDebug) {
$this->edebug($this->Lang('Invalid recipient array').': '.$kind);
}
return false;
}
$address = trim($address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
if (!$this->ValidateAddress($address)) {
$this->SetError($this->Lang('invalid_address').': '. $address);
if ($this->exceptions) {
throw new phpmailerException($this->Lang('invalid_address').': '.$address);
}
if ($this->SMTPDebug) {
$this->edebug($this->Lang('invalid_address').': '.$address);
}
return false;
}
if ($kind != 'Reply-To') {
if (!isset($this->all_recipients[strtolower($address)])) {
array_push($this->$kind, array($address, $name));
$this->all_recipients[strtolower($address)] = true;
return true;
}
} else {
if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
$this->ReplyTo[strtolower($address)] = array($address, $name);
return true;
}
}
return false;
} | CWE-79 | 1 |
protected function configure() {
// set ARGS
$this->ARGS = $_SERVER['REQUEST_METHOD'] === 'POST'? $_POST : $_GET;
// set thumbnails path
$path = $this->options['tmbPath'];
if ($path) {
if (!file_exists($path)) {
if (@mkdir($path)) {
chmod($path, $this->options['tmbPathMode']);
} else {
$path = '';
}
}
if (is_dir($path) && is_readable($path)) {
$this->tmbPath = $path;
$this->tmbPathWritable = is_writable($path);
}
}
// set image manipulation library
$type = preg_match('/^(imagick|gd|auto)$/i', $this->options['imgLib'])
? strtolower($this->options['imgLib'])
: 'auto';
if (($type == 'imagick' || $type == 'auto') && extension_loaded('imagick')) {
$this->imgLib = 'imagick';
} else {
$this->imgLib = function_exists('gd_info') ? 'gd' : '';
}
// check archivers
if (empty($this->archivers['create'])) {
$this->disabled[] ='archive';
}
if (empty($this->archivers['extract'])) {
$this->disabled[] ='extract';
}
$_arc = $this->getArchivers();
if (empty($_arc['create'])) {
$this->disabled[] ='zipdl';
}
// check 'statOwner' for command `chmod`
if (empty($this->options['statOwner'])) {
$this->disabled[] ='chmod';
}
// check 'mimeMap'
if (!is_array($this->options['mimeMap'])) {
$this->options['mimeMap'] = array();
}
} | CWE-89 | 0 |
public static function json() {
$token = Options::v('tokens');
$token = json_decode($token, true);
$newtoken = array(
TOKEN => array(
'time' => TOKEN_TIME,
'ip' => TOKEN_IP,
'url' => TOKEN_URL
)
);
if(is_array($token)){
$newtoken = array_merge($token, $newtoken);
}
$newtoken = self::ridOld($newtoken);
$newtoken = json_encode($newtoken);
return $newtoken;
}
| CWE-89 | 0 |
public function delete() {
global $user;
$count = $this->address->find('count', 'user_id=' . $user->id);
if($count > 1)
{
$address = new address($this->params['id']);
if ($user->isAdmin() || ($user->id == $address->user_id)) {
if ($address->is_billing)
{
$billAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$billAddress->is_billing = true;
$billAddress->save();
}
if ($address->is_shipping)
{
$shipAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id);
$shipAddress->is_shipping = true;
$shipAddress->save();
}
parent::delete();
}
}
else
{
flash("error", gt("You must have at least one address."));
}
expHistory::back();
} | CWE-89 | 0 |
public function handleRequest() {
/* Load error handling class */
$this->loadErrorHandler();
$this->modx->invokeEvent('OnHandleRequest');
/* save page to manager object. allow custom actionVar choice for extending classes. */
$this->action = isset($_REQUEST[$this->actionVar]) ? $_REQUEST[$this->actionVar] : $this->defaultAction;
/* invoke OnManagerPageInit event */
$this->modx->invokeEvent('OnManagerPageInit',array('action' => $this->action));
$this->prepareResponse();
} | CWE-79 | 1 |
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 load_template()
{
global $DB;
global $website;
$template = new template();
if( $this->association == 'free' ||
($this->association == 'category' && $this->embedding == '0'))
{
$template->load($this->template);
}
else
{
$category_template = $DB->query_single(
'template',
'nv_structure',
' id = '.protect($this->category).' AND website = '.$website->id
);
$template->load($category_template);
}
return $template;
}
| CWE-89 | 0 |
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId());
$this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']);
} | CWE-639 | 9 |
public function validateForField(App\Request $request)
{
$fieldModel = Vtiger_Module_Model::getInstance($request->getModule())->getFieldByName($request->getByType('fieldName', 2));
if (!$fieldModel || !$fieldModel->isActiveField() || !$fieldModel->isViewEnabled()) {
throw new \App\Exceptions\NoPermitted('ERR_NO_PERMISSIONS_TO_FIELD', 406);
}
$recordModel = \Vtiger_Record_Model::getCleanInstance($fieldModel->getModuleName());
$fieldModel->getUITypeModel()->setValueFromRequest($request, $recordModel, 'fieldValue');
$response = new Vtiger_Response();
$response->setResult([
'raw' => $recordModel->get($fieldModel->getName()),
'display' => $recordModel->getDisplayValue($fieldModel->getName()),
]);
$response->emit();
} | CWE-434 | 5 |
function update_vendor() {
$vendor = new vendor();
$vendor->update($this->params['vendor']);
expHistory::back();
} | CWE-89 | 0 |
function update() {
parent::update();
expSession::clearAllUsersSessionCache('navigation');
}
| CWE-89 | 0 |
public function offset($value)
{
$this->offset = max(0, $value);
return $this;
} | CWE-22 | 2 |
public function disable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public function showall() {
expHistory::set('viewable', $this->params);
$limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;
if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {
$limit = '0';
}
$order = isset($this->config['order']) ? $this->config['order'] : "rank";
$page = new expPaginator(array(
'model'=>'photo',
'where'=>$this->aggregateWhereClause(),
'limit'=>$limit,
'order'=>$order,
'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],
'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),
'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),
'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null,
'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'
),
));
assign_to_template(array(
'page'=>$page,
'params'=>$this->params,
));
} | CWE-89 | 0 |
public function approve_submit() {
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
/* 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->body = $this->params['body'];
$comment->approved = $this->params['approved'];
$comment->save();
expHistory::back();
} | CWE-89 | 0 |
function exception_for($reason)
{
return $reason instanceof \Exception
? $reason
: new RejectionException($reason);
} | CWE-89 | 0 |
public function addTab($array)
{
if (!$array) {
$this->setAPIResponse('error', 'no data was sent', 422);
return null;
}
$array = $this->checkKeys($this->getTableColumnsFormatted('tabs'), $array);
$array['group_id'] = ($array['group_id']) ?? $this->getDefaultGroupId();
$array['category_id'] = ($array['category_id']) ?? $this->getDefaultCategoryId();
$array['enabled'] = ($array['enabled']) ?? 0;
$array['default'] = ($array['default']) ?? 0;
$array['type'] = ($array['type']) ?? 1;
$array['order'] = ($array['order']) ?? $this->getNextTabOrder() + 1;
if (array_key_exists('name', $array)) {
$array['name'] = htmlspecialchars($array['name']);
if ($this->isTabNameTaken($array['name'])) {
$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);
return false;
}
} else {
$this->setAPIResponse('error', 'Tab name was not supplied', 422);
return false;
}
if (!array_key_exists('url', $array) && !array_key_exists('url_local', $array)) {
$this->setAPIResponse('error', 'Tab url or url_local was not supplied', 422);
return false;
}
if (!array_key_exists('image', $array)) {
$this->setAPIResponse('error', 'Tab image was not supplied', 422);
return false;
}
$response = [
array(
'function' => 'query',
'query' => array(
'INSERT INTO [tabs]',
$array
)
),
];
$this->setAPIResponse(null, 'Tab added');
$this->setLoggerChannel('Tab Management');
$this->logger->debug('Added Tab for [' . $array['name'] . ']');
return $this->processQueries($response);
} | CWE-79 | 1 |
protected function execute(InputInterface $input, OutputInterface $output)
{
/** @psalm-suppress PossiblyNullReference */
$command = $this->getApplication()->find('db:check');
$arguments = array(
'command' => 'db:check',
);
$cmdInput = new ArrayInput($arguments);
$returnCode = $command->run($cmdInput, $output);
if ($returnCode === 1) {
$output->writeln(array(
'Database update starting',
'========================',
));
$Config = Config::getConfig();
$Update = new Update($Config, new Sql());
$Update->runUpdateScript();
$output->writeln('All done.');
}
return 0;
} | CWE-307 | 26 |
function createWhereClause($owner, $filter, $search, $daterange, $ok, $warning, $critical, $unknown)
{
$where_clause = "";
// owner
if($owner == "owned"){ $where_clause .= " AND owner != ''"; }
elseif($owner == "not owned"){ $where_clause .= " AND owner = ''"; }
// advanced search (with *)
if($search != ""){
$like = "";
if( substr($search, 0, 1) === '*' ){
$like .= "%";
}
$like .= trim($search, '*');
if ( substr($search, -1) === '*' ) {
$like .= "%";
}
$where_clause .= " AND $filter LIKE '$like'";
}
// daterange
if($daterange != ""){
$daterange_parts = explode(" - ", $daterange);
$start = $daterange_parts[0];
$end = $daterange_parts[1];
// modify start and end timestamp (1 Jan 1970 = -3600).
// perhaps a little bug from DateRangePicker
$start = strtotime($start);
$start += 3600;
$end = strtotime($end);
$end += 86400 + 3600;
$where_clause .= " AND o_sec > $start AND o_sec < $end";
}
// states
$states_list = "";
if($ok != "") { $states_list .= "0,"; }
if($warning != "") { $states_list .= "1,"; }
if($critical != "") { $states_list .= "2,"; }
if($unknown != "") { $states_list .= "3,"; }
$states_list = trim($states_list, ",");
if($states_list != ""){
$where_clause .= " AND state IN ($states_list)";
}
$where_clause .= " ORDER BY o_sec DESC LIMIT 500";
return $where_clause;
} | CWE-78 | 6 |
protected function _filePutContents($path, $content) {
if (@file_put_contents($path, $content, LOCK_EX) !== false) {
clearstatcache();
return true;
}
return false;
} | CWE-89 | 0 |
function phoromatic_quit_if_invalid_input_found($input_keys = null)
{
if(empty($input_keys))
{
// Check them all if not being selective about what keys to check
$input_keys = array_keys($_REQUEST);
}
// backup as to sanitization and stripping elsewhere, safeguard namely check for things like < for fields that shouldn't have it
// plus a few simple backups as safeguards for words that really have no legit relevance within Phoromatic...
foreach(array('<', 'document.write', '../', 'onerror', 'onload', 'alert(') as $invalid_string)
{
foreach($input_keys as $key)
{
if(isset($_REQUEST[$key]) && !empty($_REQUEST[$key]))
{
foreach(pts_arrays::to_array($_REQUEST[$key]) as $val_to_check)
{
if(stripos($val_to_check, $invalid_string) !== false)
{
echo '<strong>Exited due to invalid input ( ' . $invalid_string . ') attempted:</strong> ' . htmlspecialchars($val_to_check);
exit;
}
}
}
}
}
} | CWE-79 | 1 |
foreach($fields as $field)
{
if(substr($key, 0, strlen($field.'-'))==$field.'-')
$this->dictionary[substr($key, strlen($field.'-'))][$field] = $value;
}
| CWE-79 | 1 |
protected function getComment()
{
$comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id'));
if (empty($comment)) {
throw new PageNotFoundException();
}
if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) {
throw new AccessForbiddenException();
}
return $comment;
} | CWE-639 | 9 |
function configure() {
expHistory::set('editable', $this->params);
// little bit of trickery so that that categories can have their own configs
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
$pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc);
$views = expTemplate::get_config_templates($this, $this->loc);
$gc = new geoCountry();
$countries = $gc->find('all');
$gr = new geoRegion();
$regions = $gr->find('all');
assign_to_template(array(
'config'=>$this->config,
'pullable_modules'=>$pullable_modules,
'views'=>$views,
'countries'=>$countries,
'regions'=>$regions,
'title'=>static::displayname()
));
} | CWE-89 | 0 |
self::removeLevel($kid->id);
}
}
| CWE-89 | 0 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-22 | 2 |
$this->admin->json_response = ['status' => 'error', 'message' => $e->getMessage()]; | CWE-79 | 1 |
function process_subsections($parent_section, $subtpl) {
global $db, $router;
$section = new stdClass();
$section->parent = $parent_section->id;
$section->name = $subtpl->name;
$section->sef_name = $router->encode($section->name);
$section->subtheme = $subtpl->subtheme;
$section->active = $subtpl->active;
$section->public = $subtpl->public;
$section->rank = $subtpl->rank;
$section->page_title = $subtpl->page_title;
$section->keywords = $subtpl->keywords;
$section->description = $subtpl->description;
$section->id = $db->insertObject($section, 'section');
self::process_section($section, $subtpl);
}
| CWE-89 | 0 |
public function Quit($close_on_error = true) {
$this->error = null; // so there is no confusion
if(!$this->connected()) {
$this->error = array(
"error" => "Called Quit() without being connected");
return false;
}
// send the quit command to the server
fputs($this->smtp_conn,"quit" . $this->CRLF);
// get any good-bye messages
$byemsg = $this->get_lines();
if($this->do_debug >= 2) {
$this->edebug("SMTP -> FROM SERVER:" . $byemsg . $this->CRLF . '<br />');
}
$rval = true;
$e = null;
$code = substr($byemsg,0,3);
if($code != 221) {
// use e as a tmp var cause Close will overwrite $this->error
$e = array("error" => "SMTP server rejected quit command",
"smtp_code" => $code,
"smtp_rply" => substr($byemsg,4));
$rval = false;
if($this->do_debug >= 1) {
$this->edebug("SMTP -> ERROR: " . $e["error"] . ": " . $byemsg . $this->CRLF . '<br />');
}
}
if(empty($e) || $close_on_error) {
$this->Close();
}
return $rval;
} | CWE-79 | 1 |
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 |
public function setBaseUri(Response $response)
{
$response->headers->set('Content-Security-Policy', 'base-uri \'self\'', false);
} | CWE-79 | 1 |
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 |
function delete() {
global $db;
if (empty($this->params['id'])) return false;
$product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);
$product = new $product_type($this->params['id'], true, false);
//eDebug($product_type);
//eDebug($product, true);
//if (!empty($product->product_type_id)) {
//$db->delete($product_type, 'id='.$product->product_id);
//}
$db->delete('option', 'product_id=' . $product->id . " AND optiongroup_id IN (SELECT id from " . $db->prefix . "optiongroup WHERE product_id=" . $product->id . ")");
$db->delete('optiongroup', 'product_id=' . $product->id);
//die();
$db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type="' . $product_type . '"');
if ($product->product_type == "product") {
if ($product->hasChildren()) {
$this->deleteChildren();
}
}
$product->delete();
flash('message', gt('Product deleted successfully.'));
expHistory::back();
} | CWE-89 | 0 |
public function rules()
{
$ignore = Rule::unique('users')->ignore($this->id ?? 0, 'id');
return [
'email' => [
$ignore,
],
'username' => [
$ignore,
],
];
} | CWE-190 | 19 |
private function getCriterionValue($value) {
if ($value instanceof \AbstractQuery) {
return $value->getQuery();
} else if ($value instanceof \QueryExpression) {
return $value->getValue();
} else if (DBmysql::isNameQuoted($value)) { //FIXME: database related
return $value;
} else if ($value instanceof \QueryParam) {
return $value->getValue();
} else {
return $this->analyseCriterionValue($value);
}
} | CWE-89 | 0 |
public static function textEncode( $mix )
{
if ( is_array( $mix ) )
return implode(',', array_map( array('ezjscAjaxContent', 'textEncode'), array_filter( $mix ) ) );
return $mix;
} | CWE-79 | 1 |
static function validUTF($string) {
if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {
return false;
}
return true;
} | CWE-89 | 0 |
public static function post($vars) {
switch (SMART_URL) {
case true:
$inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php/":"/";
if (Options::v('multilang_enable') === 'on') {
$lang = Language::isActive();
$lang = !empty($lang)? $lang . '/': '';
$url = Site::$url.$inFold. $lang .self::slug($vars)."/{$vars}";
}else{
$url = Site::$url.$inFold.self::slug($vars)."/{$vars}";
}
break;
default:
if (Options::v('multilang_enable') === 'on') {
$lang = Language::isActive();
$lang = !empty($lang)? '&lang=' . $lang: '';
$url = Site::$url."/?post={$vars}{$lang}";
}else{
$url = Site::$url."/?post={$vars}";
}
break;
}
return $url;
}
| CWE-89 | 0 |
recyclebin::sendToRecycleBin($loc, $parent);
//FIXME if we delete the module & sectionref the module completely disappears
// if (class_exists($secref->module)) {
// $modclass = $secref->module;
// //FIXME: more module/controller glue code
// if (expModules::controllerExists($modclass)) {
// $modclass = expModules::getControllerClassName($modclass);
// $mod = new $modclass($loc->src);
// $mod->delete_instance();
// } else {
// $mod = new $modclass();
// $mod->deleteIn($loc);
// }
// }
}
// $db->delete('sectionref', 'section=' . $parent);
$db->delete('section', 'parent=' . $parent);
}
| CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('SELECT *
FROM nv_webuser_groups
WHERE website = '.protect($website->id),
'object');
$out = $DB->result();
return $out;
}
| CWE-89 | 0 |
function getFontSize()
{
$fs = $GLOBALS['PMA_Config']->get('fontsize');
if (!is_null($fs)) {
return $fs;
}
if (isset($_COOKIE['pma_fontsize'])) {
return $_COOKIE['pma_fontsize'];
}
return '82%';
} | CWE-79 | 1 |
public function delete() {
global $db;
/* 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('Missing id for the comment you would like to delete'));
expHistory::back();
}
// delete the comment
$comment = new expComment($this->params['id']);
$comment->delete();
// delete the association too
$db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']);
// send the user back where they came from.
expHistory::back();
} | CWE-89 | 0 |
$ip = getenv('HTTP_FORWARDED');
}
else {
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
} | CWE-89 | 0 |
protected function getStatusCode($exception)
{
if ($exception instanceof HttpExceptionInterface) {
$code = $exception->getStatusCode();
}
elseif ($exception instanceof AjaxException) {
$code = 406;
}
else {
$code = 500;
}
return $code;
}
| CWE-532 | 28 |
private function runCallback() {
foreach ($this->records as &$record) {
if (isset($record->ref_type)) {
$refType = $record->ref_type;
if (class_exists($record->ref_type)) {
$type = new $refType();
$classinfo = new ReflectionClass($type);
if ($classinfo->hasMethod('paginationCallback')) {
$item = new $type($record->original_id);
$item->paginationCallback($record);
}
}
}
}
} | CWE-89 | 0 |
protected function gdImage($image, $filename, $destformat, $mime, $jpgQuality = null ){
if (!$jpgQuality) {
$jpgQuality = $this->options['jpgQuality'];
}
if ($destformat == 'jpg' || ($destformat == null && $mime == 'image/jpeg')) {
return imagejpeg($image, $filename, $jpgQuality);
}
if ($destformat == 'gif' || ($destformat == null && $mime == 'image/gif')) {
return imagegif($image, $filename, 7);
}
return imagepng($image, $filename, 7);
} | CWE-89 | 0 |
public function addTab($array)
{
if (!$array) {
$this->setAPIResponse('error', 'no data was sent', 422);
return null;
}
$array = $this->checkKeys($this->getTableColumnsFormatted('tabs'), $array);
$array['group_id'] = ($array['group_id']) ?? $this->getDefaultGroupId();
$array['category_id'] = ($array['category_id']) ?? $this->getDefaultCategoryId();
$array['enabled'] = ($array['enabled']) ?? 0;
$array['default'] = ($array['default']) ?? 0;
$array['type'] = ($array['type']) ?? 1;
$array['order'] = ($array['order']) ?? $this->getNextTabOrder() + 1;
if (array_key_exists('name', $array)) {
$array['name'] = htmlspecialchars($array['name']);
if ($this->isTabNameTaken($array['name'])) {
$this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409);
return false;
}
} else {
$this->setAPIResponse('error', 'Tab name was not supplied', 422);
return false;
}
if (!array_key_exists('url', $array) && !array_key_exists('url_local', $array)) {
$this->setAPIResponse('error', 'Tab url or url_local was not supplied', 422);
return false;
}
if (!array_key_exists('image', $array)) {
$this->setAPIResponse('error', 'Tab image was not supplied', 422);
return false;
}
$response = [
array(
'function' => 'query',
'query' => array(
'INSERT INTO [tabs]',
$array
)
),
];
$this->setAPIResponse(null, 'Tab added');
$this->setLoggerChannel('Tab Management');
$this->logger->debug('Added Tab for [' . $array['name'] . ']');
return $this->processQueries($response);
} | CWE-79 | 1 |
$rst[$key] = self::parseAndTrim($st, $unescape);
}
return $rst;
}
$str = str_replace("<br>"," ",$str);
$str = str_replace("</br>"," ",$str);
$str = str_replace("<br/>"," ",$str);
$str = str_replace("<br />"," ",$str);
$str = str_replace("\r\n"," ",$str);
$str = str_replace('"',""",$str);
$str = str_replace("'","'",$str);
$str = str_replace("’","’",$str);
$str = str_replace("‘","‘",$str);
$str = str_replace("®","®",$str);
$str = str_replace("–","-", $str);
$str = str_replace("—","—", $str);
$str = str_replace("”","”", $str);
$str = str_replace("“","“", $str);
$str = str_replace("¼","¼",$str);
$str = str_replace("½","½",$str);
$str = str_replace("¾","¾",$str);
$str = str_replace("™","™", $str);
$str = trim($str);
if ($unescape) {
$str = stripcslashes($str);
} else {
$str = addslashes($str);
}
return $str;
} | CWE-89 | 0 |
foreach ($fields as $field) {
$fieldName = $field->fieldName;
if ($field->type == 'date' || $field->type == 'dateTime') {
if (is_numeric($record->$fieldName))
$record->$fieldName = Formatter::formatLongDateTime($record->$fieldName);
}elseif ($field->type == 'link') {
$name = $record->$fieldName;
if (!empty($field->linkType)) {
list($name, $id) = Fields::nameAndId($name);
}
if (!empty($name))
$record->$fieldName = $name;
}elseif ($fieldName == 'visibility') {
$record->$fieldName = $record->$fieldName == 1 ? 'Public' : 'Private';
}
} | CWE-79 | 1 |
public function confirm()
{
$project = $this->getProject();
$this->response->html($this->helper->layout->project('action/remove', array(
'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')),
'available_events' => $this->eventManager->getAll(),
'available_actions' => $this->actionManager->getAvailableActions(),
'project' => $project,
'title' => t('Remove an action')
)));
} | CWE-639 | 9 |
public function StartTLS() {
$this->error = null; # to avoid confusion
if(!$this->connected()) {
$this->error = array("error" => "Called StartTLS() without being connected");
return false;
}
fputs($this->smtp_conn,"STARTTLS" . $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 != 220) {
$this->error =
array("error" => "STARTTLS 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;
}
// Begin encrypted connection
if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
return false;
}
return true;
} | CWE-79 | 1 |
public function setAuthorizedBackendSession()
{
$_SESSION['authorized'] = true;
$_SESSION['lastSessionId'] = time();
$_SESSION['tstamp'] = time();
$_SESSION['expires'] = time() + $this->expireTimeInMinutes * 60;
$_SESSION['isBackendSession'] = true;
// Renew the session id to avoid session fixation
$this->renewSession();
} | CWE-613 | 7 |
$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 |
protected function itemLocked($hash)
{
if (!elFinder::$commonTempPath) {
return false;
}
$lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock';
if (file_exists($lock)) {
if (filemtime($lock) + $this->itemLockExpire < time()) {
unlink($lock);
return false;
}
return true;
}
return false;
} | CWE-78 | 6 |
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 scrap($param) {
if ($param != '') {
foreach ($param as $k => $v) {
if (is_array($v)) {
foreach ($v as $k2 => $v2) {
$data[$k2] = $v2;
}
}else{
$data = '';
}
}
} else {
$data = '';
}
return $data;
}
| CWE-89 | 0 |
function update() {
parent::update();
expSession::clearAllUsersSessionCache('navigation');
}
| 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']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
$require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
$require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
$notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for note to approve'));
$lastUrl = expHistory::getLast('editable');
}
$simplenote = new expSimpleNote($this->params['id']);
assign_to_template(array(
'simplenote'=>$simplenote,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
'tab'=>$this->params['tab']
));
} | CWE-89 | 0 |
public function admin () {
User::secure();
System::gZip();
if( User::access(2) ) {
System::versionCheck();
Control::handler('backend');
}else{
Theme::admin('header');
Control::error('noaccess');
Theme::admin('footer');
}
System::Zipped();
}
| CWE-89 | 0 |
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_restriction/show', array(
'status_list' => array(
SubtaskModel::STATUS_TODO => t('Todo'),
SubtaskModel::STATUS_DONE => t('Done'),
),
'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
public function setModelAttributes(&$model,&$attributeList,&$params) {
$data = array ();
foreach($attributeList as &$attr) {
if(!isset($attr['name'],$attr['value']))
continue;
if(null !== $field = $model->getField($attr['name'])) {
// first do variable/expression evaluation, // then process with X2Fields::parseValue()
$type = $field->type;
$value = $attr['value'];
if(is_string($value)){
if(strpos($value, '=') === 0){
$evald = X2FlowFormatter::parseFormula($value, $params);
if(!$evald[0])
return false;
$value = $evald[1];
} elseif($params !== null){
if(is_string($value) && isset($params['model'])){
$value = X2FlowFormatter::replaceVariables(
$value, $params['model'], $type);
}
}
}
$data[$attr['name']] = $value;
}
}
if (!isset ($model->scenario))
$model->setScenario ('X2Flow');
$model->setX2Fields ($data);
if ($model instanceof Actions && isset($data['complete'])) {
switch($data['complete']) {
case 'Yes':
$model->complete();
break;
case 'No':
$model->uncomplete();
break;
}
}
return true;
} | CWE-79 | 1 |
public static function isPublic($s) {
if ($s == null) {
return false;
}
while ($s->public && $s->parent > 0) {
$s = new section($s->parent);
}
$lineage = (($s->public) ? 1 : 0);
return $lineage;
}
| CWE-89 | 0 |
public function insert($ip, $username)
{
$this->Log = ClassRegistry::init('Log');
$this->Log->create();
$expire = time() + Configure::read('SecureAuth.expire');
$expire = date('Y-m-d H:i:s', $expire);
$bruteforceEntry = array(
'ip' => $ip,
'username' => $username,
'expire' => $expire
);
$this->save($bruteforceEntry);
$title = 'Failed login attempt using username ' . $username . ' from IP: ' . $_SERVER['REMOTE_ADDR'] . '.';
if ($this->isBlacklisted($ip, $username)) {
$title .= 'This has tripped the bruteforce protection after ' . Configure::read('SecureAuth.amount') . ' failed attempts. The user is now blacklisted for ' . Configure::read('SecureAuth.expire') . ' seconds.';
}
$log = array(
'org' => 'SYSTEM',
'model' => 'User',
'model_id' => 0,
'email' => $username,
'action' => 'login_fail',
'title' => $title
);
$this->Log->save($log);
} | CWE-367 | 29 |
public function fetchRow($sql)
{
// retrieve row
$query_id = $this->query($sql);
$record = mysql_fetch_row($this->query_id);
$this->freeResult($query_id);
return $record;
}#-#fetchArray() | CWE-89 | 0 |
function categoryBreadcrumb() {
// global $db, $router;
//eDebug($this->category);
/*if(isset($router->params['action']))
{
$ancestors = $this->category->pathToNode();
}else if(isset($router->params['section']))
{
$current = $db->selectObject('section',' id= '.$router->params['section']);
$ancestors[] = $current;
if( $current->parent != -1 || $current->parent != 0 )
{
while ($db->selectObject('section',' id= '.$router->params['section']);)
if ($section->id == $id) {
$current = $section;
break;
}
}
}
eDebug($sections);
$ancestors = $this->category->pathToNode();
}*/
$ancestors = $this->category->pathToNode();
// eDebug($ancestors);
assign_to_template(array(
'ancestors' => $ancestors
));
} | CWE-89 | 0 |
function db_properties($table)
{
global $DatabaseType, $DatabaseUsername;
switch ($DatabaseType) {
case 'mysqli':
$result = DBQuery("SHOW COLUMNS FROM $table");
while ($row = db_fetch_row($result)) {
$properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '('));
if (!$pos = strpos($row['TYPE'], ','))
$pos = strpos($row['TYPE'], ')');
else
$properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1);
$properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos);
if ($row['NULL'] != '')
$properties[strtoupper($row['FIELD'])]['NULL'] = "Y";
else
$properties[strtoupper($row['FIELD'])]['NULL'] = "N";
}
break;
}
return $properties;
} | CWE-79 | 1 |
public function 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 function renderAttribute ($name) {
switch ($name) {
case 'name':
echo $this->relatedModel->getLink (/*array (
'class' => 'quick-read-link',
'data-id' => $this->relatedModel->id,
'data-class' => get_class ($this->relatedModel),
'data-name' => CHtml::encode ($this->relatedModel->name),
)*/);
break;
case 'relatedModelName':
echo $this->getRelatedModelName ();
break;
case 'assignedTo':
echo $this->relatedModel->renderAttribute ('assignedTo');
break;
case 'label':
echo $this->getLabel ();
break;
case 'createDate':
echo X2Html::dynamicDate ($this->relatedModel->createDate);
break;
}
} | CWE-79 | 1 |
public function edit(Request $request, $id) {
return $this->view('post::admin.posts.edit', [
'content_id'=>$id
]);
} | CWE-79 | 1 |
return !isset($thisstaff) || $f->isRequiredForStaff();
};
if (!$form->isValid($filter))
$valid = false;
//Make sure the email is not in-use
if (($field=$form->getField('email'))
&& $field->getClean()
&& User::lookup(array('emails__address'=>$field->getClean()))) {
$field->addError(__('Email is assigned to another user'));
$valid = false;
}
return $valid ? self::fromVars($form->getClean(), $create) : null;
} | CWE-1236 | 12 |
public static function meta($cont_title='', $cont_desc='', $pre =''){
global $data;
//print_r($data);
//if(empty($data['posts'][0]->title)){
if(is_array($data) && isset($data['posts'][0]->title)){
$sitenamelength = strlen(Options::get('sitename'));
$limit = 70-$sitenamelength-6;
$cont_title = substr(Typo::Xclean(Typo::strip($data['posts'][0]->title)),0,$limit);
$titlelength = strlen($data['posts'][0]->title);
if($titlelength > $limit+3) { $dotted = "...";} else {$dotted = "";}
$cont_title = "{$pre} {$cont_title}{$dotted} - ";
}else{
$cont_title = "";
}
if(is_array($data) && isset($data['posts'][0]->content)){
$desc = Typo::strip($data['posts'][0]->content);
}else{
$desc = "";
}
$meta = "
<!--// Start Meta: Generated Automaticaly by GeniXCMS -->
<!-- SEO: Title stripped 70chars for SEO Purpose -->
<title>{$cont_title}".Options::get('sitename')."</title>
<meta name=\"Keyword\" content=\"".Options::get('sitekeywords')."\">
<!-- SEO: Description stripped 150chars for SEO Purpose -->
<meta name=\"Description\" content=\"".self::desc($desc)."\">
<meta name=\"Author\" content=\"Puguh Wijayanto | MetalGenix IT Solutions - www.metalgenix.com\">
<meta name=\"Generator\" content=\"GeniXCMS\">
<meta name=\"robots\" content=\"".Options::get('robots')."\">
<meta name=\"revisit-after\" content=\" days\">
<link rel=\"shortcut icon\" href=\"".Options::get('siteicon')."\" />
";
$meta .= "
<!-- Generated Automaticaly by GeniXCMS :End Meta //-->";
echo $meta;
} | CWE-79 | 1 |
public function getTrackingId()
{
if(isset($this->ectid)) return $this->ectid;
else return '';
} | CWE-89 | 0 |
public function check(&$params){
$tags = $this->config['options']['tags']['value'];
$tags = is_array($tags) ? $tags : Tags::parseTags($tags, true);
if(!empty($tags) && isset($params['tags'])){ // Check passed params to be sure they're set
if(!is_array($params['tags'])){
$params['tags'] = explode(',', $params['tags']);
}
$params['tags'] = array_map(function($item){
return preg_replace('/^#/','', $item);
}, $params['tags']);
// must have at least 1 tag in the list:
if(count(array_intersect($params['tags'], $tags)) > 0){
return $this->checkConditions($params);
}else{
return array(false, Yii::t('studio','No tags on the record matched those in the tag trigger criteria.'));
}
}else{ // config is invalid or record has no tags (tags are not optional)
return array(false, empty($tags) ? Yii::t('studio','No tags in the trigger criteria!') : Yii::t('studio','Tags parameter missing!'));
}
} | CWE-79 | 1 |
public function __construct() {
$this->options['alias'] = ''; // alias to replace root dir name
$this->options['dirMode'] = 0755; // new dirs mode
$this->options['fileMode'] = 0644; // new files mode
$this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden)
$this->options['rootCssClass'] = 'elfinder-navbar-root-local';
$this->options['followSymLinks'] = true;
} | CWE-89 | 0 |
protected function _fopen($path, $mode='rb') {
if (($mode == 'rb' || $mode == 'r')) {
try {
$res = $this->dropbox->media($path);
$url = parse_url($res['url']);
$fp = stream_socket_client('ssl://'.$url['host'].':443');
fputs($fp, "GET {$url['path']} HTTP/1.0\r\n");
fputs($fp, "Host: {$url['host']}\r\n");
fputs($fp, "\r\n");
while(trim(fgets($fp)) !== ''){};
return $fp;
} catch (Dropbox_Exception $e) {
return false;
}
}
if ($this->tmp) {
$contents = $this->_getContents($path);
if ($contents === false) {
return false;
}
if ($local = $this->getTempFile($path)) {
if (file_put_contents($local, $contents, LOCK_EX) !== false) {
return @fopen($local, $mode);
}
}
}
return false;
} | CWE-89 | 0 |
public function search() {
// global $db, $user;
global $db;
$sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email ";
$sql .= "from " . $db->prefix . "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 __construct () {
} | CWE-89 | 0 |
public static function isPublic($s) {
if ($s == null) {
return false;
}
while ($s->public && $s->parent > 0) {
$s = new section($s->parent);
}
$lineage = (($s->public) ? 1 : 0);
return $lineage;
}
| CWE-89 | 0 |
$banner->increaseImpressions();
}
}
// assign banner to the template and show it!
assign_to_template(array(
'banners'=>$banners
));
} | CWE-89 | 0 |
public function save()
{
global $DB;
if(!empty($this->id))
return $this->update();
else
return $this->insert();
}
| CWE-79 | 1 |
public function get() {
$r = '<div class="title gallery_div">'.$this->stack_name.'</div>';
for ($i = 0; $i < count($this->tiles_array); $i++) {
$top = rand(-5, 5);
$left = rand(-5, 5);
$img_w = $this->tiles_array[$i]->getWidth();
$extra = '';
if ($img_w < IMAGE_WIDTH) {
$extra = 'width:'.$img_w.'px;';
}
$r .= '<div class="miniature_border gallery_div" style="background-image:url(\''.$this->tiles_array[$i]->getMiniatureSrc().'\');margin-top:'.$top.'px; margin-left:'.$left.'px;'.$extra.'"></div>';
}
return $r;
} | CWE-79 | 1 |
function preview()
{
if ($this->params['id'] == 0) { // we want the default editor
$demo = new stdClass();
$demo->id = 0;
$demo->name = "Default";
if ($this->params['editor'] == 'ckeditor') {
$demo->skin = 'kama';
} elseif ($this->params['editor'] == 'tinymce') {
$demo->skin = 'lightgray';
}
} else {
$demo = self::getEditorSettings($this->params['id'], expString::escape($this->params['editor']));
}
assign_to_template(
array(
'demo' => $demo,
'editor' => $this->params['editor']
)
);
} | CWE-89 | 0 |
function MAX_adRenderImageBeacon($logUrl, $beaconId = 'beacon', $userAgent = null)
{
if (!isset($userAgent) && isset($_SERVER['HTTP_USER_AGENT'])) {
$userAgent = $_SERVER['HTTP_USER_AGENT'];
}
$beaconId .= '_{random}';
// Add beacon image for logging
if (isset($userAgent) && preg_match("#Mozilla/(1|2|3|4)#", $userAgent)
&& !preg_match("#compatible#", $userAgent)) {
$div = "<layer id='{$beaconId}' width='0' height='0' border='0' visibility='hide'>";
$style = '';
$divEnd = '</layer>';
} else {
$div = "<div id='{$beaconId}' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'>";
$style = " style='width: 0px; height: 0px;'";
$divEnd = '</div>';
}
$beacon = "$div<img src='".htmlspecialchars($logUrl)."' width='0' height='0' alt=''{$style} />{$divEnd}";
return $beacon;
} | CWE-79 | 1 |
public function remove()
{
$project = $this->getProject();
$this->checkCSRFParam();
$column_id = $this->request->getIntegerParam('column_id');
if ($this->columnModel->remove($column_id)) {
$this->flash->success(t('Column removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this column.'));
}
$this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public function setContainer($container)
{
$this->container = $container;
$container->setType('ctBanner');
} | CWE-79 | 1 |
public function confirm()
{
$task = $this->getTask();
$link = $this->getTaskLink();
$this->response->html($this->template->render('task_internal_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | CWE-639 | 9 |
function critere_where_dist($idb, &$boucles, $crit) {
$boucle = &$boucles[$idb];
if (isset($crit->param[0])) {
$_where = calculer_liste($crit->param[0], $idb, $boucles, $boucle->id_parent);
} else {
$_where = '@$Pile[0]["where"]';
}
if ($crit->cond) {
$_where = "(($_where) ? ($_where) : '')";
}
if ($crit->not) {
$_where = "array('NOT',$_where)";
}
$boucle->where[] = $_where;
} | CWE-89 | 0 |
public function getQueryGroupby()
{
return "a.id";
} | CWE-89 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.