code
stringlengths
23
2.05k
label_name
stringlengths
6
7
label
int64
0
37
function searchByModelForm() { // get the search terms $terms = $this->params['search_string']; $sql = "model like '%" . $terms . "%'"; $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10; $page = new expPaginator(array( 'model' => 'product', 'where' => $sql, 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit, 'order' => 'title', 'dir' => 'DESC', 'page' => (isset($this->params['page']) ? $this->params['page'] : 1), 'controller' => $this->params['controller'], 'action' => $this->params['action'], 'columns' => array( gt('Model #') => 'model', gt('Product Name') => 'title', gt('Price') => 'base_price' ), )); assign_to_template(array( 'page' => $page, 'terms' => $terms )); }
CWE-20
0
public function save($check_notify = false) { if (isset($_POST['email_recipients']) && is_array($_POST['email_recipients'])) { $this->email_recipients = base64_encode(serialize($_POST['email_recipients'])); } return parent::save($check_notify); }
CWE-287
4
function selectArraysBySql($sql) { $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($res == null) return array(); $arrays = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $arrays[] = mysqli_fetch_assoc($res); return $arrays; }
CWE-74
1
public function addTable( $table, $alias ) { if ( empty( $table ) ) { throw new \MWException( __METHOD__ . ': An empty table name was passed.' ); } if ( empty( $alias ) || is_numeric( $alias ) ) { throw new \MWException( __METHOD__ . ': An empty or numeric table alias was passed.' ); } if ( !isset( $this->tables[$alias] ) ) { $this->tables[$alias] = $this->DB->tableName( $table ); return true; } else { return false; } }
CWE-400
2
$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-74
1
public function shouldRun(DateTime $date) { global $timedate; $runDate = clone $date; $this->handleTimeZone($runDate); $cron = Cron\CronExpression::factory($this->schedule); if (empty($this->last_run) && $cron->isDue($runDate)) { return true; } $lastRun = $this->last_run ? $timedate->fromDb($this->last_run) : $timedate->fromDb($this->date_entered); $this->handleTimeZone($lastRun); $next = $cron->getNextRunDate($lastRun); return $next <= $runDate; }
CWE-287
4
$rest = $count - ( floor( $nsize ) * floor( $iGroup ) ); if ( $rest > 0 ) { $nsize += 1; } $output .= "{|" . $rowColFormat . "\n|\n"; for ( $g = 0; $g < $iGroup; $g++ ) { $output .= $lister->formatList( $articles, $nstart, $nsize ); if ( $columns != 1 ) { $output .= "\n|valign=top|\n"; } else { $output .= "\n|-\n|\n"; } $nstart = $nstart + $nsize; // if ($rest != 0 && $g+1==$rest) $nsize -= 1; if ( $nstart + $nsize > $count ) { $nsize = $count - $nstart; } } $output .= "\n|}\n"; } elseif ( $rowSize > 0 ) {
CWE-400
2
public function manage() { expHistory::set('manageable',$this->params); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( 'countries'=>$countries, 'regions'=>$regions )); }
CWE-74
1
public static function getIconName($module) { return isset(static::$iconNames[$module]) ? static::$iconNames[$module] : strtolower(str_replace('_', '-', $module)); }
CWE-287
4
public static function onRegistration() { if ( !defined( 'DPL_VERSION' ) ) { define( 'DPL_VERSION', '3.3.5' ); } }
CWE-400
2
public function testOnKernelResponseWithoutSession() { $tokenStorage = new TokenStorage(); $tokenStorage->setToken(new UsernamePasswordToken('test1', 'pass1', 'phpunit')); $request = new Request(); $request->attributes->set('_security_firewall_run', true); $session = new Session(new MockArraySessionStorage()); $request->setSession($session); $event = new ResponseEvent( $this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MAIN_REQUEST, new Response() ); $listener = new ContextListener($tokenStorage, [], 'session', null, new EventDispatcher()); $listener->onKernelResponse($event); $this->assertTrue($session->isStarted()); }
CWE-287
4
public function AddBCC($address, $name = '') { return $this->AddAnAddress('bcc', $address, $name); }
CWE-20
0
public function testNotRemoveAuthorizationHeaderOnRedirect() { $mock = new MockHandler([ new Response(302, ['Location' => 'http://example.com/2']), static function (RequestInterface $request) { self::assertTrue($request->hasHeader('Authorization')); return new Response(200); } ]); $handler = HandlerStack::create($mock); $client = new Client(['handler' => $handler]); $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass']]); }
CWE-200
10
public function testRemoveCurlAuthorizationOptionsOnRedirect($auth) { if (!defined('\CURLOPT_HTTPAUTH')) { self::markTestSkipped('ext-curl is required for this test'); } $mock = new MockHandler([ new Response(302, ['Location' => 'http://test.com']), static function (RequestInterface $request, $options) { self::assertFalse( isset($options['curl'][\CURLOPT_HTTPAUTH]), 'curl options still contain CURLOPT_HTTPAUTH entry' ); self::assertFalse( isset($options['curl'][\CURLOPT_USERPWD]), 'curl options still contain CURLOPT_USERPWD entry' ); return new Response(200); } ]); $handler = HandlerStack::create($mock); $client = new Client(['handler' => $handler]); $client->get('http://example.com?a=b', ['auth' => ['testuser', 'testpass', $auth]]); }
CWE-200
10
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$str); $str = str_replace("&quot;",'"',$str); $str = str_replace("&#39;","'",$str); $str = str_replace("&rsquo;","'",$str); $str = str_replace("&lsquo;","'",$str); $str = str_replace("&#174;","",$str); $str = str_replace("�","-", $str); $str = str_replace("�","-", $str); $str = str_replace("�", '"', $str); $str = str_replace("&rdquo;",'"', $str); $str = str_replace("�", '"', $str); $str = str_replace("&ldquo;",'"', $str); $str = str_replace("\r\n"," ",$str); $str = str_replace("�"," 1/4",$str); $str = str_replace("&#188;"," 1/4", $str); $str = str_replace("�"," 1/2",$str); $str = str_replace("&#189;"," 1/2",$str); $str = str_replace("�"," 3/4",$str); $str = str_replace("&#190;"," 3/4",$str); $str = str_replace("�", "(TM)", $str); $str = str_replace("&trade;","(TM)", $str); $str = str_replace("&reg;","(R)", $str); $str = str_replace("�","(R)",$str); $str = str_replace("&","&amp;",$str); $str = str_replace(">","&gt;",$str); return trim($str); }
CWE-74
1
protected function getBodyTagAttributes() { $formEngineParameters = []; $parameters = parent::getBodyTagAttributes(); $formEngineParameters['fieldChangeFunc'] = $this->parameters['fieldChangeFunc']; $formEngineParameters['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($this->parameters['fieldChangeFunc'])); $parameters['data-add-on-params'] .= HttpUtility::buildQueryString(['P' => $formEngineParameters], '&'); return $parameters; }
CWE-327
3
public function showall() { global $user, $sectionObj, $sections; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // all we need to do is determine the current section $navsections = $sections; if ($sectionObj->parent == -1) { $current = $sectionObj; } else { foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } assign_to_template(array( 'sections' => $navsections, 'current' => $current, 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0), )); }
CWE-74
1
public function __get($var) { switch ($var) { case 'configuration_array': $this->configuration_array = array(); if ($this->configuration != ''){ $jsonData = json_decode($this->configuration,true); if ($jsonData !== null) { $this->configuration_array = $jsonData; } else { $this->configuration_array = array(); } } return $this->configuration_array; break; case 'name_support': return $this->name_support = $this->nick; break; case 'has_photo': return $this->filename != ''; break; case 'photo_path': $this->photo_path = ($this->filepath != '' ? '//' . $_SERVER['HTTP_HOST'] . erLhcoreClassSystem::instance()->wwwDir() : erLhcoreClassSystem::instance()->wwwImagesDir() ) .'/'. $this->filepath . $this->filename; return $this->photo_path; break; case 'file_path_server': return $this->filepath . $this->filename; break; default: break; } }
CWE-116
15
private function checkAuthenticationTag() { if ($this->authentication_tag === $this->calculateAuthenticationTag()) { return true; } else { throw new JOSE_Exception_UnexpectedAlgorithm('Invalid authentication tag'); } }
CWE-200
10
private static function thumb($source_path, $thumb_path){ ini_set('memory_limit', '128M'); $source_details = getimagesize($source_path); $source_w = $source_details[0]; $source_h = $source_details[1]; if($source_w > $source_h){ $new_w = self::THUMB_W; $new_h = intval($source_h * $new_w / $source_w); } else { $new_h = self::THUMB_H; $new_w = intval($source_w * $new_h / $source_h); } switch($source_details[2]){ case IMAGETYPE_GIF: $imgt = "imagegif"; $imgcreatefrom = "imagecreatefromgif"; break; case IMAGETYPE_JPEG: $imgt = "imagejpeg"; $imgcreatefrom = "imagecreatefromjpeg"; break; case IMAGETYPE_PNG: $imgt = "imagepng"; $imgcreatefrom = "imagecreatefrompng"; break; case IMAGETYPE_WEBP: $imgt = "imagewebp"; $imgcreatefrom = "imagecreatefromwebp"; break; case IMAGETYPE_WBMP: $imgt = "imagewbmp"; $imgcreatefrom = "imagecreatefromwbmp"; break; case IMAGETYPE_BMP: $imgt = "imagebmp"; $imgcreatefrom = "imagecreatefrombmp"; break; default: return false; } $old_image = $imgcreatefrom($source_path); $new_image = imagecreatetruecolor($new_w, $new_h); imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, $new_w, $new_h, $source_w, $source_h); $new_image = self::fix_orientation($source_path, $new_image); $old_image = self::fix_orientation($source_path, $old_image); $imgt($new_image, $thumb_path); $imgt($old_image, $source_path); return true; }
CWE-20
0
function manage() { expHistory::set('viewable', $this->params); // $category = new storeCategory(); // $categories = $category->getFullTree(); // // // foreach($categories as $i=>$val){ // // if (!empty($this->values) && in_array($val->id,$this->values)) { // // $this->tags[$i]->value = true; // // } else { // // $this->tags[$i]->value = false; // // } // // $this->tags[$i]->draggable = $this->draggable; // // $this->tags[$i]->checkable = $this->checkable; // // } // // $obj = json_encode($categories); }
CWE-74
1
function edit_internalalias() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
CWE-74
1
public function getDisplayName ($plural=true) { return Yii::t('workflow', '{process}', array( '{process}' => Modules::displayName($plural, 'Process'), )); }
CWE-20
0
public function execute(&$params){ $options = &$this->config['options']; $notif = new Notification; $notif->user = $this->parseOption('user', $params); $notif->createdBy = 'API'; $notif->createDate = time(); // file_put_contents('triggerLog.txt',"\n".$notif->user,FILE_APPEND); // if($this->parseOption('type',$params) == 'auto') { // if(!isset($params['model'])) // return false; // $notif->modelType = get_class($params['model']); // $notif->modelId = $params['model']->id; // $notif->type = $this->getNotifType(); // } else { $notif->type = 'custom'; $notif->text = $this->parseOption('text', $params); // } if ($notif->save()) { return array (true, ""); } else { return array(false, array_shift($notif->getErrors())); } }
CWE-20
0
public function clearTags() { $this->_tags = array(); // clear tag cache return (bool) CActiveRecord::model('Tags')->deleteAllByAttributes(array( 'type' => get_class($this->getOwner()), 'itemId' => $this->getOwner()->id) ); }
CWE-20
0
public function actionAppendTag() { if (isset($_POST['Type'], $_POST['Id'], $_POST['Tag']) && preg_match('/^[\w\d_-]+$/', $_POST['Type'])) { if (!class_exists($_POST['Type'])) { echo 'false'; return; } $model = X2Model::model($_POST['Type'])->findByPk($_POST['Id']); echo $model->addTags($_POST['Tag']); exit; if ($model !== null && $model->addTags($_POST['Tag'])) { echo 'true'; return; } } echo 'false'; }
CWE-20
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-74
1
$input = ['name' => 'ldap', 'rootdn_passwd' => $password];
CWE-327
3
public function autocomplete() { return; global $db; $model = $this->params['model']; $mod = new $model(); $srchcol = explode(",",$this->params['searchoncol']); /*for ($i=0; $i<count($srchcol); $i++) { if ($i>=1) $sql .= " OR "; $sql .= $srchcol[$i].' LIKE \'%'.$this->params['query'].'%\''; }*/ // $sql .= ' AND parent_id=0'; //eDebug($sql); //$res = $mod->find('all',$sql,'id',25); $sql = "select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from ".$db->prefix."product as p INNER JOIN ".$db->prefix."content_expfiles as cef ON p.id=cef.content_id INNER JOIN ".$db->prefix."expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') desc LIMIT 25"; //$res = $db->selectObjectsBySql($sql); //$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`'); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
CWE-74
1
function columnUpdate($table, $col, $val, $where=1) { $res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where"); /*if ($res == null) return array(); $objects = array(); for ($i = 0; $i < mysqli_num_rows($res); $i++) $objects[] = mysqli_fetch_object($res);*/ //return $objects; }
CWE-74
1
static function isSearchable() { return true; }
CWE-74
1
public function getDisplayName ($plural=true) { return Yii::t('calendar', 'Calendar'); }
CWE-20
0
public function searchAdmin(){ $criteria = new CDbCriteria; return $this->searchBase($criteria); }
CWE-20
0
public function rename() { if (!AuthUser::hasPermission('file_manager_rename')) { Flash::set('error', __('You do not have sufficient permissions to rename this file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/rename')) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } $data = $_POST['file']; $data['current_name'] = str_replace('..', '', $data['current_name']); $data['new_name'] = str_replace('..', '', $data['new_name']); // Clean filenames $data['new_name'] = preg_replace('/ /', '_', $data['new_name']); $data['new_name'] = preg_replace('/[^a-z0-9_\-\.]/i', '', $data['new_name']); $path = substr($data['current_name'], 0, strrpos($data['current_name'], '/')); $file = FILES_DIR . '/' . $data['current_name']; // Check another file doesn't already exist with same name if (file_exists(FILES_DIR . '/' . $path . '/' . $data['new_name'])) { Flash::set('error', __('A file or directory with that name already exists!')); redirect(get_url('plugin/file_manager/browse/' . $path)); } if (file_exists($file)) { if (!rename($file, FILES_DIR . '/' . $path . '/' . $data['new_name'])) Flash::set('error', __('Permission denied!')); } else { Flash::set('error', __('File or directory not found!' . $file)); } redirect(get_url('plugin/file_manager/browse/' . $path)); }
CWE-20
0
public function save_change_password() { global $user; $isuser = ($this->params['uid'] == $user->id) ? 1 : 0; if (!$user->isAdmin() && !$isuser) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) { flash('error', gt('The current password you entered is not correct.')); expHistory::returnTo('editable'); } //eDebug($user); $u = new user($this->params['uid']); $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']); //eDebug($u, true); if (is_string($ret)) { flash('error', $ret); expHistory::returnTo('editable'); } else { $params = array(); $params['is_admin'] = !empty($u->is_admin); $params['is_acting_admin'] = !empty($u->is_acting_admin); $u->update($params); } if (!$isuser) { flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.')); } else { $user->password = $u->password; flash('message', gt('Your password has been changed.')); } expHistory::back(); }
CWE-74
1
public function create_file() { if (!AuthUser::hasPermission('file_manager_mkfile')) { Flash::set('error', __('You do not have sufficient permissions to create a file.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/create_file')) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } $data = $_POST['file']; $path = str_replace('..', '', $data['path']); $filename = str_replace('..', '', $data['name']); $file = FILES_DIR . DS . $path . DS . $filename; if (file_put_contents($file, '') !== false) { $mode = Plugin::getSetting('filemode', 'file_manager'); chmod($file, octdec($mode)); } else { Flash::set('error', __('File :name has not been created!', array(':name' => $filename))); } redirect(get_url('plugin/file_manager/browse/' . $path)); }
CWE-20
0
function formatValue( $name, $value ) { $row = $this->mCurrentRow; $wiki = $row->files_dbname; switch ( $name ) { case 'files_timestamp': $formatted = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $row->files_timestamp, $this->getUser() ) ); break; case 'files_dbname': $formatted = $row->files_dbname; break; case 'files_url': $formatted = "<img src=\"{$row->files_url}\" style=\"width:135px;height:135px;\">"; break; case 'files_name': $formatted = "<a href=\"{$row->files_page}\">{$row->files_name}</a>"; break; case 'files_user': $formatted = "<a href=\"/wiki/Special:CentralAuth/{$row->files_user}\">{$row->files_user}</a>"; break; default: $formatted = "Unable to format $name"; break; } return $formatted; }
CWE-20
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-74
1
private function _notuses( $option ) { if ( count( $option ) > 0 ) { $where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['templatelinks'] . '.tl_from FROM ' . $this->tableNames['templatelinks'] . ' WHERE ('; $ors = []; foreach ( $option as $linkGroup ) { foreach ( $linkGroup as $link ) { $_or = '(' . $this->tableNames['templatelinks'] . '.tl_namespace=' . intval( $link->getNamespace() ); if ( $this->parameters->getParameter( 'ignorecase' ) ) { $_or .= ' AND LOWER(CAST(' . $this->tableNames['templatelinks'] . '.tl_title AS char))=LOWER(' . $this->DB->addQuotes( $link->getDbKey() ) . '))'; } else { $_or .= ' AND ' . $this->tableNames['templatelinks'] . '.tl_title=' . $this->DB->addQuotes( $link->getDbKey() ) . ')'; } $ors[] = $_or; } } $where .= implode( ' OR ', $ors ) . '))'; } $this->addWhere( $where ); }
CWE-400
2
function adodb_addslashes($s) { $len = strlen($s); if ($len == 0) return "''"; if (strncmp($s,"'",1) === 0 && substr($s,$len-1) == "'") return $s; // already quoted return "'".addslashes($s)."'"; }
CWE-287
4
static function description() { return gt("This module is for managing categories in your store."); }
CWE-74
1
public function addTags($tags) { $result = false; $addedTags = array(); foreach ((array) $tags as $tagName) { if (empty($tagName)) continue; if (!in_array($tagName, $this->getTags())) { // check for duplicate tag $tag = new Tags; $tag->tag = '#' . ltrim($tagName, '#'); $tag->itemId = $this->getOwner()->id; $tag->type = get_class($this->getOwner()); $tag->taggedBy = Yii::app()->getSuName(); $tag->timestamp = time(); $tag->itemName = $this->getOwner()->name; if ($tag->save()) { $this->_tags[] = $tag->tag; // update tag cache $addedTags[] = $tagName; $result = true; } else { throw new CHttpException(422, 'Failed saving tag due to errors: ' . json_encode($tag->errors)); } } } if ($this->flowTriggersEnabled) X2Flow::trigger('RecordTagAddTrigger', array( 'model' => $this->getOwner(), 'tags' => $addedTags, )); return $result; }
CWE-20
0
foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; }
CWE-74
1
public function setTableSortMethod($method = null) { $this->tableSortMethod = $method === null ? 'standard' : $method; }
CWE-400
2
imagepng( $im_crop, $output ); } $new_avatar = false; if ( file_exists( $output ) ) { $old_avatar = get_user_meta( $user_id, '_lp_profile_picture', true ); if ( file_exists( $upload_dir['basedir'] . '/' . $old_avatar ) ) { @unlink( $upload_dir['basedir'] . '/' . $old_avatar ); } $new_avatar = preg_replace( '!^/!', '', $upload_dir['subdir'] ) . '/' . $newname; update_user_meta( $user_id, '_lp_profile_picture', $new_avatar ); update_user_meta( $user_id, '_lp_profile_picture_changed', 'yes' ); $new_avatar = $upload_dir['baseurl'] . '/' . $new_avatar; } @unlink( $path ); return $new_avatar; }
CWE-610
17
$db->insertObject($obj, 'expeAlerts_subscribers'); } $count = count($this->params['ealerts']); if ($count > 0) { flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.')); } else { flash('error', gt("You have been unsubscribed from all E-Alerts.")); } expHistory::back(); }
CWE-74
1
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-20
0
public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) { $config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'globalnewfiles' ); if ( $config->get( 'CreateWikiDatabase' ) === $config->get( 'DBname' ) ) { $updater->addExtensionTable( 'gnf_files', __DIR__ . '/../sql/gnf_files.sql' ); $updater->modifyExtensionField( 'gnf_files', 'files_timestamp', __DIR__ . '/../sql/patches/patch-gnf_files-binary.sql' ); $updater->modifyTable( 'gnf_files', __DIR__ . '/../sql/patches/patch-gnf_files-add-indexes.sql', true ); } return true; }
CWE-20
0
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id); if (!empty($newret)) $ret .= $newret . '<br>'; if ($iLoc->mod == 'container') { $ret .= scan_container($container->internal, $page_id); } } return $ret; }
CWE-74
1
public static function validateServer($path, $values) { $result = array( 'Server' => '', 'Servers/1/user' => '', 'Servers/1/SignonSession' => '', 'Servers/1/SignonURL' => '' ); $error = false; if ($values['Servers/1/auth_type'] == 'config' && empty($values['Servers/1/user']) ) { $result['Servers/1/user'] = __( 'Empty username while using [kbd]config[/kbd] authentication method!' ); $error = true; } if ($values['Servers/1/auth_type'] == 'signon' && empty($values['Servers/1/SignonSession']) ) { $result['Servers/1/SignonSession'] = __( 'Empty signon session name ' . 'while using [kbd]signon[/kbd] authentication method!' ); $error = true; } if ($values['Servers/1/auth_type'] == 'signon' && empty($values['Servers/1/SignonURL']) ) { $result['Servers/1/SignonURL'] = __( 'Empty signon URL while using [kbd]signon[/kbd] authentication ' . 'method!' ); $error = true; } if (! $error && $values['Servers/1/auth_type'] == 'config') { $password = $values['Servers/1/nopassword'] ? null : $values['Servers/1/password']; $test = static::testDBConnection( $values['Servers/1/connect_type'], $values['Servers/1/host'], $values['Servers/1/port'], $values['Servers/1/socket'], $values['Servers/1/user'], $password, 'Server' ); if ($test !== true) { $result = array_merge($result, $test); } } return $result; }
CWE-200
10
function token($str) { $fw=$this->fw; $str=trim(preg_replace('/\{\{(.+?)\}\}/s',trim('\1'), $fw->compile($str))); if (preg_match('/^(.+)(?<!\|)\|((?:\h*\w+(?:\h*[,;]?))+)$/s', $str,$parts)) { $str=trim($parts[1]); foreach ($fw->split(trim($parts[2],"\xC2\xA0")) as $func) $str=((empty($this->filter[$cmd=$func]) && function_exists($cmd)) || is_string($cmd=$this->filter($func)))? $cmd.'('.$str.')': 'Base::instance()->'. 'call($this->filter(\''.$func.'\'),['.$str.'])'; } return $str; }
CWE-20
0
public function testLogoutDelete() { $GLOBALS['cfg']['Server']['auth_swekey_config'] = ''; $GLOBALS['cfg']['CaptchaLoginPrivateKey'] = ''; $GLOBALS['cfg']['CaptchaLoginPublicKey'] = ''; $_REQUEST['old_usr'] = 'pmaolduser'; $GLOBALS['cfg']['LoginCookieDeleteAll'] = true; $GLOBALS['cfg']['Servers'] = array(1); $_COOKIE['pmaPass-0'] = 'test'; $this->object->authCheck(); $this->assertFalse( isset($_COOKIE['pmaPass-0']) ); }
CWE-200
10
protected function parseImageUrlWithPath( $article ) { $imageUrl = ''; if ( $article instanceof \DPL\Article ) { if ( $article->mNamespace == NS_FILE ) { // calculate URL for existing images // $img = Image::newFromName($article->mTitle->getText()); $img = wfFindFile( \Title::makeTitle( NS_FILE, $article->mTitle->getText() ) ); if ( $img && $img->exists() ) { $imageUrl = $img->getURL(); } else { $fileTitle = \Title::makeTitleSafe( NS_FILE, $article->mTitle->getDBKey() ); $imageUrl = \RepoGroup::singleton()->getLocalRepo()->newFile( $fileTitle )->getPath(); } } } else { $title = \Title::newfromText( 'File:' . $article ); if ( $title !== null ) { $fileTitle = \Title::makeTitleSafe( 6, $title->getDBKey() ); $imageUrl = \RepoGroup::singleton()->getLocalRepo()->newFile( $fileTitle )->getPath(); } } //@TODO: Check this preg_replace. Probably only works for stock file repositories. --Alexia $imageUrl = preg_replace( '~^.*images/(.*)~', '\1', $imageUrl ); return $imageUrl; }
CWE-400
2
public function actionGetItems(){ $sql = 'SELECT id, name as value, subject FROM x2_bug_reports WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); exit; }
CWE-20
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-20
0
private function _allrevisionssince( $option ) { $this->addTable( 'revision_actor_temp', 'rev' ); $this->addSelect( [ 'rev.revactor_rev', 'rev.revactor_timestamp' ] ); $this->addOrderBy( 'rev.revactor_rev' ); $this->setOrderDir( 'DESC' ); $this->addWhere( [ $this->tableNames['page'] . '.page_id = rev.revactor_page', 'rev.revactor_timestamp >= ' . $this->convertTimestamp( $option ) ] ); }
CWE-400
2
function searchByModelForm() { // get the search terms $terms = $this->params['search_string']; $sql = "model like '%" . $terms . "%'"; $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10; $page = new expPaginator(array( 'model' => 'product', 'where' => $sql, 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit, 'order' => 'title', 'dir' => 'DESC', 'page' => (isset($this->params['page']) ? $this->params['page'] : 1), 'controller' => $this->params['controller'], 'action' => $this->params['action'], 'columns' => array( gt('Model #') => 'model', gt('Product Name') => 'title', gt('Price') => 'base_price' ), )); assign_to_template(array( 'page' => $page, 'terms' => $terms )); }
CWE-20
0
public static function checkPermissions($permission,$location) { global $exponent_permissions_r, $router; // only applies to the 'manage' method if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) { if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) { foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; } } } return false; }
CWE-74
1
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-20
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-74
1
public function IsHTML($ishtml = true) { if ($ishtml) { $this->ContentType = 'text/html'; } else { $this->ContentType = 'text/plain'; } }
CWE-20
0
static function description() { return "Manage events and schedules, and optionally publish them."; }
CWE-74
1
public function testAuthCheckToken() { $GLOBALS['cfg']['Server']['SignonURL'] = 'http://phpmyadmin.net/SignonURL'; $GLOBALS['cfg']['Server']['SignonSession'] = 'session123'; $GLOBALS['cfg']['Server']['host'] = 'localhost'; $GLOBALS['cfg']['Server']['port'] = '80'; $GLOBALS['cfg']['Server']['user'] = 'user'; $GLOBALS['cfg']['Server']['SignonScript'] = ''; $_COOKIE['session123'] = true; $_REQUEST['old_usr'] = 'oldUser'; $_SESSION['PMA_single_signon_user'] = 'user123'; $_SESSION['PMA_single_signon_password'] = 'pass123'; $_SESSION['PMA_single_signon_host'] = 'local'; $_SESSION['PMA_single_signon_port'] = '12'; $_SESSION['PMA_single_signon_cfgupdate'] = array('foo' => 'bar'); $_SESSION['PMA_single_signon_token'] = 'pmaToken'; $sessionName = session_name(); $sessionID = session_id(); $this->assertFalse( $this->object->authCheck() ); $this->assertEquals( array( 'SignonURL' => 'http://phpmyadmin.net/SignonURL', 'SignonScript' => '', 'SignonSession' => 'session123', 'host' => 'local', 'port' => '12', 'user' => 'user', 'foo' => 'bar' ), $GLOBALS['cfg']['Server'] ); $this->assertEquals( 'pmaToken', $_SESSION[' PMA_token '] ); $this->assertEquals( $sessionName, session_name() ); $this->assertEquals( $sessionID, session_id() ); $this->assertFalse( isset($_SESSION['LAST_SIGNON_URL']) ); }
CWE-200
10
protected function assertNoPHPErrors () { $this->assertElementNotPresent('css=.xdebug-error'); $this->assertElementNotPresent('css=#x2-php-error'); }
CWE-20
0
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
CWE-200
10
public function testRenderWithTrustedHeaderDisabled() { Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, ''); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest(Request::create('/'))); $this->assertSame('foo', $strategy->render('/', Request::create('/'))->getContent()); }
CWE-20
0
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
CWE-200
10
public function test_valid_comment_0_content() { $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => '0', ), ) ); $this->assertNotIXRError( $result ); }
CWE-862
8
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-200
10
function checkPassword($username, $password) { $doUser = OA_Dal::factoryDO('users'); $doUser->username = strtolower($username); $doUser->password = md5($password); $doUser->find(); if ($doUser->fetch()) { return $doUser; } else { return false; } }
CWE-287
4
$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-74
1
public function delete() { if (!AuthUser::hasPermission('file_manager_delete')) { Flash::set('error', __('You do not have sufficient permissions to delete a file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } $paths = func_get_args(); $file = urldecode(join('/', $paths)); // CSRF checks if (isset($_GET['csrf_token'])) { $csrf_token = $_GET['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/delete/'.$file)) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } $file = FILES_DIR . '/' . str_replace('..', '', $file); $filename = array_pop($paths); $paths = join('/', $paths); if (is_file($file)) { if (!unlink($file)) Flash::set('error', __('Permission denied!')); } else { if (!$this->_rrmdir($file)) Flash::set('error', __('Permission denied!')); } redirect(get_url('plugin/file_manager/browse/' . $paths)); }
CWE-20
0
public function __construct( \DPL\Parameters $parameters, \Parser $parser ) { $this->setHeadListAttributes( $parameters->getParameter( 'hlistattr' ) ); $this->setHeadItemAttributes( $parameters->getParameter( 'hitemattr' ) ); $this->setListAttributes( $parameters->getParameter( 'listattr' ) ); $this->setItemAttributes( $parameters->getParameter( 'itemattr' ) ); $this->setDominantSectionCount( $parameters->getParameter( 'dominantsection' ) ); $this->setTemplateSuffix( $parameters->getParameter( 'defaulttemplatesuffix' ) ); $this->setTrimIncluded( $parameters->getParameter( 'includetrim' ) ); $this->setTableSortColumn( $parameters->getParameter( 'tablesortcol' ) ); $this->setTableSortMethod($parameters->getParameter('tablesortmethod')); $this->setTitleMaxLength( $parameters->getParameter( 'titlemaxlen' ) ); $this->setEscapeLinks( $parameters->getParameter( 'escapelinks' ) ); $this->setSectionSeparators( $parameters->getParameter( 'secseparators' ) ); $this->setMultiSectionSeparators( $parameters->getParameter( 'multisecseparators' ) ); $this->setIncludePageText( $parameters->getParameter( 'incpage' ) ); $this->setIncludePageMaxLength( $parameters->getParameter( 'includemaxlen' ) ); $this->setPageTextMatch( (array)$parameters->getParameter( 'seclabels' ) ); $this->setPageTextMatchRegex( (array)$parameters->getParameter( 'seclabelsmatch' ) ); $this->setPageTextMatchNotRegex( (array)$parameters->getParameter( 'seclabelsnotmatch' ) ); $this->setIncludePageParsed( $parameters->getParameter( 'incparsed' ) ); $this->parameters = $parameters; $this->parser = clone $parser; }
CWE-400
2
$files[$key]->save(); } // eDebug($files,true); }
CWE-74
1
public function getLayout(){ $layout = $this->getAttribute('layout'); $initLayout = $this->initLayout(); if(!$layout){ // layout hasn't been initialized? $layout = $initLayout; $this->layout = json_encode($layout); $this->update(array('layout')); }else{ $layout = json_decode($layout, true); // json to associative array $this->addRemoveLayoutElements('center', $layout, $initLayout); $this->addRemoveLayoutElements('left', $layout, $initLayout); $this->addRemoveLayoutElements('right', $layout, $initLayout); } return $layout; }
CWE-20
0
public static function navtojson() { return json_encode(self::navhierarchy()); }
CWE-74
1
$iloc = expUnserialize($container->internal); if ($db->selectObject('sectionref',"module='".$iloc->mod."' AND source='".$iloc->src."'") == null) { // There is no sectionref for this container. Populate sectionref if ($container->external != "N;") { $newSecRef = new stdClass(); $newSecRef->module = $iloc->mod; $newSecRef->source = $iloc->src; $newSecRef->internal = ''; $newSecRef->refcount = 1; // $newSecRef->is_original = 1; $eloc = expUnserialize($container->external); // $section = $db->selectObject('sectionref',"module='containermodule' AND source='".$eloc->src."'"); $section = $db->selectObject('sectionref',"module='container' AND source='".$eloc->src."'"); if (!empty($section)) { $newSecRef->section = $section->id; $db->insertObject($newSecRef,"sectionref"); $missing_sectionrefs[] = gt("Missing sectionref for container replaced").": ".$iloc->mod." - ".$iloc->src." - PageID #".$section->id; } else { $db->delete('container','id="'.$container->id.'"'); $missing_sectionrefs[] = gt("Cant' find the container page for container").": ".$iloc->mod." - ".$iloc->src.' - '.gt('deleted'); } } } } assign_to_template(array( 'missing_sectionrefs'=>$missing_sectionrefs, )); }
CWE-74
1
private function _maxrevisions( $option ) { $this->addWhere( "((SELECT count(rev_aux3.revactor_page) FROM {$this->tableNames['revision_actor_temp']} AS rev_aux3 WHERE rev_aux3.revactor_page = {$this->tableNames['page']}.page_id) <= {$option})" ); }
CWE-400
2
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
CWE-200
10
protected function checkMaintenanceMode() { if (Yii::$app->settings->get('maintenanceMode')) { if (!Yii::$app->user->isGuest) { Yii::$app->user->logout(); Yii::$app->getView()->warn(Yii::t('error', 'Maintenance mode activated: You have been automatically logged out and will no longer have access the platform until the maintenance has been completed.')); } return Yii::$app->getResponse()->redirect(['/user/auth/login']); } }
CWE-863
11
fwrite(STDERR, sprintf("%2d %s ==> %s\n", $i + 1, $test, var_export($result, true)));
CWE-330
12
public function actionPublishPost() { $post = new Events; // $user = $this->loadModel($id); if (isset($_POST['text']) && $_POST['text'] != "") { $post->text = $_POST['text']; $post->visibility = $_POST['visibility']; if (isset($_POST['associationId'])) $post->associationId = $_POST['associationId']; //$soc->attributes = $_POST['Social']; //die(var_dump($_POST['Social'])); $post->user = Yii::app()->user->getName(); $post->type = 'feed'; $post->subtype = $_POST['subtype']; $post->lastUpdated = time(); $post->timestamp = time(); if ($post->save()) { if (!empty($post->associationId) && $post->associationId != Yii::app()->user->getId()) { $notif = new Notification; $notif->type = 'social_post'; $notif->createdBy = $post->user; $notif->modelType = 'Profile'; $notif->modelId = $post->associationId; $notif->user = Yii::app()->db->createCommand() ->select('username') ->from('x2_users') ->where('id=:id', array(':id' => $post->associationId)) ->queryScalar(); // $prof = X2Model::model('Profile')->findByAttributes(array('username'=>$post->user)); // $notif->text = "$prof->fullName posted on your profile."; // $notif->record = "profile:$prof->id"; // $notif->viewed = 0; $notif->createDate = time(); // $subject=X2Model::model('Profile')->findByPk($id); // $notif->user = $subject->username; $notif->save(); } } } }
CWE-20
0
public function createTag($name, $options = NULL) { $this->run('tag', $options, $name); return $this; }
CWE-77
14
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-74
1
static function isSearchable() { return true; }
CWE-74
1
public function confirm() { global $db; // make sure we have what we need. if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.')); if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.')); // verify the id/key pair $id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash="'.$this->params['key'].'"'); if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.')); // activate this users pending subscriptions $sub = new stdClass(); $sub->enabled = 1; $db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id); // find the users active subscriptions $ealerts = expeAlerts::getBySubscriber($id); assign_to_template(array( 'ealerts'=>$ealerts )); }
CWE-74
1
$modelName = ucfirst ($module->name); if (class_exists ($modelName)) { // prefix widget class name with custom module model name and a delimiter $cache[$widgetType][$modelName.'::TemplatesGridViewProfileWidget'] = Yii::t( 'app', '{modelName} Summary', array ('{modelName}' => $modelName)); } } } } return $cache[$widgetType]; }
CWE-20
0
public function Set($_var = '', $_value = '', $_vartrusted = false, $_valuetrusted = false) { if ($_var != '' && $_value != '' ) { if (!$_vartrusted) { $_var = strip_tags($_var); } if (!$_valuetrusted) { $_value = strip_tags($_value, '<br />'); } if (strtolower($_var) == 'message' || strtolower($_var) == 'subject' ) { $_value = $this->convertLatin1ToHtml($_value); } $this->t_data[$_var] = $_value; } }
CWE-732
13
public function getFilePath($fileName = null) { if ($fileName === null) { $fileName = $this->fileName; } return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName; }
CWE-610
17
function edit_freeform() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
CWE-74
1
private function _getMetaTags() { $retval = '<meta charset="utf-8" />'; $retval .= '<meta name="robots" content="noindex,nofollow" />'; $retval .= '<meta http-equiv="X-UA-Compatible" content="IE=Edge">'; $retval .= '<style>html{display: none;}</style>'; return $retval; }
CWE-20
0
function XMLRPCendRequest($requestid) { global $user; $requestid = processInputData($requestid, ARG_NUMERIC); $userRequests = getUserRequests('all', $user['id']); $found = 0; foreach($userRequests as $req) { if($req['id'] == $requestid) { $request = getRequestInfo($requestid); $found = 1; break; } } if(! $found) return array('status' => 'error', 'errorcode' => 1, 'errormsg' => 'unknown requestid'); deleteRequest($request); return array('status' => 'success'); }
CWE-20
0
public static function restoreX2AuthManager () { if (isset (self::$_oldAuthManagerComponent)) { Yii::app()->setComponent ('authManager', self::$_oldAuthManagerComponent); } else { throw new CException ('X2AuthManager component could not be restored'); } }
CWE-20
0
function execute_backup($command) { $backup_options = get_option('dbmanager_options'); check_backup_files(); if( realpath( $backup_options['path'] ) === false ) { return sprintf( __( '%s is not a valid backup path', 'wp-dbmanager' ), stripslashes( $backup_options['path'] ) ); } else if( dbmanager_is_valid_path( $backup_options['mysqldumppath'] ) === 0 ) { return sprintf( __( '%s is not a valid mysqldump path', 'wp-dbmanager' ), stripslashes( $backup_options['mysqldumppath'] ) ); } else if( dbmanager_is_valid_path( $backup_options['mysqlpath'] ) === 0 ) { return sprintf( __( '%s is not a valid mysql path', 'wp-dbmanager' ), stripslashes( $backup_options['mysqlpath'] ) ); } if(substr(PHP_OS, 0, 3) == 'WIN') { $writable_dir = $backup_options['path']; $tmpnam = $writable_dir.'/wp-dbmanager.bat'; $fp = fopen($tmpnam, 'w'); fwrite($fp, $command); fclose($fp); system($tmpnam.' > NUL', $error); unlink($tmpnam); } else { passthru($command, $error); } return $error; }
CWE-20
0
public function approve_submit() { global $history; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); $lastUrl = expHistory::getLast('editable'); } /* 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']); //FIXME here is where we might sanitize the note before approving it $simplenote->body = $this->params['body']; $simplenote->approved = $this->params['approved']; $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-74
1
public function delete() { if (!AuthUser::hasPermission('file_manager_delete')) { Flash::set('error', __('You do not have sufficient permissions to delete a file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } $paths = func_get_args(); $file = urldecode(join('/', $paths)); // CSRF checks if (isset($_GET['csrf_token'])) { $csrf_token = $_GET['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/delete/'.$file)) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/browse/')); } $file = FILES_DIR . '/' . str_replace('..', '', $file); $filename = array_pop($paths); $paths = join('/', $paths); if (is_file($file)) { if (!unlink($file)) Flash::set('error', __('Permission denied!')); } else { if (!$this->_rrmdir($file)) Flash::set('error', __('Permission denied!')); } redirect(get_url('plugin/file_manager/browse/' . $paths)); }
CWE-20
0
function manage_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( 'countries'=>$countries, 'regions'=>$regions, 'upcharge'=>!empty($this->config['upcharge'])?$this->config['upcharge']:'' )); }
CWE-74
1
public function delete($id) { $this->CRUD->delete($id); $responsePayload = $this->CRUD->getResponsePayload(); if (!empty($responsePayload)) { return $responsePayload; } $this->set('metaGroup', 'Trust Circles'); }
CWE-668
7
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
CWE-200
10
public function update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { $this->flash->success(t('Swimlane updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { $errors = array('name' => array(t('Another swimlane with the same name exists in the project'))); } } return $this->edit($values, $errors); }
CWE-200
10