code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
static function lookupByUsername($username) { if (strpos($username, '@') !== false) $user = static::lookup(array('user__emails__address'=>$username)); else $user = static::lookup(array('username'=>$username)); return $user; }
CWE-89
0
public static function canView($section) { global $db; if ($section == null) { return false; } if ($section->public == 0) { // Not a public section. Check permissions. return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id)); } else { // Is public. check parents. if ($section->parent <= 0) { // Out of parents, and since we are still checking, we haven't hit a private section. return true; } else { $s = $db->selectObject('section', 'id=' . $section->parent); return self::canView($s); } } }
CWE-89
0
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-89
0
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; }
CWE-79
1
public function convertQuotes($string) { $string = str_ireplace('[QUOTE]', '<div class="quote">', $string); $string = str_ireplace('[/QUOTE]', '</div>', $string); $string = preg_replace('%\[event\]\s*(\d*)\s*\[/event\]%isU', '<a href="' . h(Configure::read('MISP.baseurl')). '/events/view/$1> Event $1</a>', $string); $string = preg_replace('%\[thread\]\s*(\d*)\s*\[/thread\]%isU', '<a href="' . h(Configure::read('MISP.baseurl')). '/threads/view/$1> Thread $1</a>', $string); $string = preg_replace('%\[link\]\s*(http|https|ftp|git|ftps)(.*)\s*\[/link\]%isU', '<a href="$1$2">$1$2</a>', $string); $string = preg_replace('%\[code\](.*)\[/code\]%isU', '<pre>$1</pre>', $string); return $string; }
CWE-79
1
public function actionGetLists() { if (!Yii::app()->user->checkAccess('ContactsAdminAccess')) { $condition = ' AND (visibility="1" OR assignedTo="Anyone" OR assignedTo="' . Yii::app()->user->getName() . '"'; /* x2temp */ $groupLinks = Yii::app()->db->createCommand()->select('groupId')->from('x2_group_to_user')->where('userId=' . Yii::app()->user->getId())->queryColumn(); if (!empty($groupLinks)) $condition .= ' OR assignedTo IN (' . implode(',', $groupLinks) . ')'; $condition .= ' OR (visibility=2 AND assignedTo IN (SELECT username FROM x2_group_to_user WHERE groupId IN (SELECT groupId FROM x2_group_to_user WHERE userId=' . Yii::app()->user->getId() . '))))'; } else { $condition = ''; } // Optional search parameter for autocomplete $qterm = isset($_GET['term']) ? $_GET['term'] . '%' : ''; $result = Yii::app()->db->createCommand() ->select('id,name as value') ->from('x2_lists') ->where('modelName="Contacts" AND type!="campaign" AND name LIKE :qterm' . $condition, array(':qterm' => $qterm)) ->order('name ASC') ->queryAll(); echo CJSON::encode($result); }
CWE-79
1
public function manage() { expHistory::set('manageable',$this->params); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( 'countries'=>$countries, 'regions'=>$regions )); }
CWE-89
0
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1) { // List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file // Char '>' '<' '|' '$' and ';' are special chars for shells. // Char '/' and '\' are file delimiters. $filesystem_forbidden_chars = array('<', '>', '/', '\\', '?', '*', '|', '"', ':', '°', '$', ';'); return dol_string_nospecial($unaccent ?dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); }
CWE-88
3
static function isSearchable() { return true; }
CWE-89
0
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth); // since most likely this function will only get hit via flash in YUI Uploader // and since Flash can't pass cookies, we lose the knowledge of our $user // so we're passing the user's ID in as $_POST data. We then instantiate a new $user, // and then assign $user->id to $file->poster so we have an audit trail for the upload if (is_object($file)) { $resized = !empty($file->resized) ? true : false; $user = new user($this->params['usrid']); $file->poster = $user->id; $file->posted = $file->last_accessed = time(); $file->save(); if (!empty($this->params['cat'])) { $expcat = new expCat($this->params['cat']); $params['expCat'][0] = $expcat->id; $file->update($params); } // a echo so YUI Uploader is notified of the function's completion if ($resized) { echo gt('File resized and then saved'); } else { echo gt('File saved'); } } else { echo gt('File was NOT uploaded!'); // flash('error',gt('File was not uploaded!')); } }
CWE-89
0
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
CWE-639
9
public function 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 confirm() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask/remove', array( 'subtask' => $subtask, 'task' => $task, ))); }
CWE-639
9
public function confirm() { $task = $this->getTask(); $link_id = $this->request->getIntegerParam('link_id'); $link = $this->taskExternalLinkModel->getById($link_id); if (empty($link)) { throw new PageNotFoundException(); } $this->response->html($this->template->render('task_external_link/remove', array( 'link' => $link, 'task' => $task, ))); }
CWE-639
9
function NewSectionPrompt(){ global $langmessage; ob_start(); echo '<div class="inline_box">'; echo '<form method="post" action="'.common::GetUrl($this->title).'">'; echo '<h2>'.$langmessage['new_section_about'].'</h2>'; echo '<table class="bordered full_width">'; echo '<tr><th colspan="2">'.$langmessage['New Section'].'</th></tr>'; echo '<tr><td>'; echo $langmessage['Content Type']; echo '</td><td>'; editing_page::SectionTypes(); echo '</td></tr>'; echo '<tr><td>'; echo $langmessage['Insert Location']; echo '</td><td>'; echo '<label><input type="radio" name="insert" value="before" /> '; echo $langmessage['insert_before']; echo '</label>'; echo '<label><input type="radio" name="insert" value="after" checked="checked" /> '; echo $langmessage['insert_after']; echo '</label>'; echo '</td></tr>'; echo '</table>'; echo '<p>'; echo '<input type="hidden" name="last_mod" value="'.$this->fileModTime.'" />'; echo '<input type="hidden" name="section" value="'.$_GET['section'].'" />'; echo '<input type="hidden" name="cmd" value="add_section" />'; echo '<input type="submit" name="" value="'.$langmessage['save'].'" class="gpsubmit"/>'; echo ' <input type="button" name="" value="'.$langmessage['cancel'].'" class="admin_box_close gpcancel" />'; echo '</p>'; echo '</form>'; echo '</div>'; $this->contentBuffer = ob_get_clean(); }
CWE-79
1
$incident_title = strip_tags(html_entity_decode(html_entity_decode($this->data->item_title, ENT_QUOTES)));
CWE-79
1
public function breadcrumb() { global $sectionObj; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // Show not only the location of a page in the hierarchy but also the location of a standalone page $current = new section($id); if ($current->parent == -1) { // standalone page $navsections = section::levelTemplate(-1, 0); foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } else { $navsections = section::levelTemplate(0, 0); foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } assign_to_template(array( 'sections' => $navsections, 'current' => $current, )); }
CWE-89
0
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-", $str); $str = str_replace("�", "&#151;", $str); $str = str_replace("�", "&rdquo;", $str); $str = str_replace("�", "&ldquo;", $str); $str = str_replace("\r\n", " ", $str); $str = str_replace("\t", " ", $str); $str = str_replace(",", "\,", $str); $str = str_replace("�", "&#188;", $str); $str = str_replace("�", "&#189;", $str); $str = str_replace("�", "&#190;", $str); if (!$isHTML) { $str = str_replace('\"', "&quot;", $str); $str = str_replace('"', "&quot;", $str); } else { $str = str_replace('"', '""', $str); } //$str = htmlspecialchars($str); //$str = utf8_encode($str); $str = trim(str_replace("�", "&trade;", $str)); //echo "2<br>"; eDebug($str,die); return $str; }
CWE-89
0
protected function assetExtensions() { return [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'ico', 'css', 'js', 'woff', 'woff2', 'svg', 'ttf', 'eot', 'json', 'md', 'less', 'sass', 'scss', 'xml' ]; }
CWE-79
1
public function confirm() { $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, 'filter' => $filter, 'title' => t('Remove a custom filter') ))); }
CWE-639
9
print_r($single_error); } echo '</pre>'; }
CWE-79
1
public function save() { $user = $this->getUser(); $values = $this->request->getValues(); if (! $this->userSession->isAdmin()) { if (isset($values['role'])) { unset($values['role']); } } list($valid, $errors) = $this->userValidator->validateModification($values); if ($valid) { if ($this->userModel->update($values)) { $this->flash->success(t('User updated successfully.')); $this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])), true); return; } else { $this->flash->failure(t('Unable to update this user.')); } } $this->show($values, $errors); }
CWE-640
20
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 update_discount() { $id = empty($this->params['id']) ? null : $this->params['id']; $discount = new discounts($id); // find required shipping method if needed if ($this->params['required_shipping_calculator_id'] > 0) { $this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']]; } else { $this->params['required_shipping_calculator_id'] = 0; } $discount->update($this->params); expHistory::back(); }
CWE-89
0
function selectObjectBySql($sql) { //$logFile = "C:\\xampp\\htdocs\\supserg\\tmp\\queryLog.txt"; //$lfh = fopen($logFile, 'a'); //fwrite($lfh, $sql . "\n"); //fclose($lfh); $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($res == null) return null; return mysqli_fetch_object($res); }
CWE-89
0
public static function strValidCharacters($string, $checkType) { if (trim($string) === '') { return false; } switch ($checkType) { case 'noSpecialChar': // a simple e-mail address should still be possible (like username) $validRegex = '/^[\w.@+-]+$/i'; break; case 'email': $validRegex = '/^[\wáàâåäæçéèêîñóòôöõøœúùûüß.@+-]+$/i'; break; case 'file': $validRegex = '=^[^/?*;:~<>|\"\\\\]+\.[^/?*;:~<>|‚\"\\\\]+$='; break; case 'folder': $validRegex = '=^[^/?*;:~<>|\"\\\\]+$='; break; case 'url': $validRegex = '/^[\wáàâåäæçéèêîñóòôöõøœúùûüß$&!?() \/%=#:~.@+-]+$/i'; break; case 'phone': $validRegex = '/^[\d() \/+-]+$/i'; break; default: return false; } // check if string contains only valid characters if (!preg_match($validRegex, $string)) { return false; } switch ($checkType) { case 'email': return filter_var(trim($string), FILTER_VALIDATE_EMAIL) !== false; case 'url': return filter_var(trim($string), FILTER_VALIDATE_URL) !== false; default: return true; } }
CWE-79
1
$period_days_append_sql= substr($period_days_append_sql,0,-4).'))'; } $exist_RET= DBGet(DBQuery("SELECT s.ID FROM schedule s WHERE student_id=". $student_id." AND s.syear='".UserSyear()."' {$mp_append_sql}{$period_days_append_sql} UNION SELECT s.ID FROM temp_schedule s WHERE student_id=". $student_id."{$mp_append_sql}{$period_days_append_sql}")); if($exist_RET) return 'There is a Period Conflict ('.$course_RET[1]['CP_TITLE'].')'; else { return true; } }
CWE-22
2
public static function get_param($key = NULL) { $info = [ 'stype' => htmlentities(self::$search_type), 'stext' => htmlentities(self::$search_text), 'method' => htmlentities(self::$search_method), 'datelimit' => self::$search_date_limit, 'fields' => self::$search_fields, 'sort' => self::$search_sort, 'chars' => htmlentities(self::$search_chars), 'order' => self::$search_order, 'forum_id' => self::$forum_id, 'memory_limit' => self::$memory_limit, 'composevars' => self::$composevars, 'rowstart' => self::$rowstart, 'search_param' => htmlentities(self::$search_param), ]; return $key === NULL ? $info : (isset($info[$key]) ? $info[$key] : NULL); }
CWE-79
1
public function getMovie($id){ $url = "http://api.themoviedb.org/3/movie/".$id."?api_key=".$this->apikey; $movie = $this->curl($url); return $movie; }
CWE-89
0
public static function getDefaultLang() { $def = Options::v('multilang_default'); $lang = json_decode(Options::v('multilang_country'), true); $deflang = $lang[$def]; return $deflang; }
CWE-89
0
foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $db->countObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1; $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $ed->find("count", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1; } }
CWE-89
0
function edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['options'] = $oi->opts; $params['user_input_fields'] = $oi->user_input_fields; $oi->product = new product($oi->product->id, true, true); if ($oi->product->parent_id != 0) { $parProd = new product($oi->product->parent_id); //$oi->product->optiongroup = $parProd->optiongroup; $oi->product = $parProd; } //FIXME we don't use selectedOpts? // $oi->selectedOpts = array(); // if (!empty($oi->opts)) { // foreach ($oi->opts as $opt) { // $option = new option($opt[0]); // $og = new optiongroup($option->optiongroup_id); // if (!isset($oi->selectedOpts[$og->id]) || !is_array($oi->selectedOpts[$og->id])) // $oi->selectedOpts[$og->id] = array($option->id); // else // array_push($oi->selectedOpts[$og->id], $option->id); // } // } //eDebug($oi->selectedOpts); assign_to_template(array( 'oi' => $oi, 'params' => $params )); }
CWE-89
0
function get_filedisplay_views() { expTemplate::get_filedisplay_views(); $paths = array( BASE.'framework/modules/common/views/file/', BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/', ); $views = array(); foreach ($paths as $path) { if (is_readable($path)) { $dh = opendir($path); while (($file = readdir($dh)) !== false) { if (is_readable($path.'/'.$file) && substr($file, -4) == '.tpl' && substr($file, -14) != '.bootstrap.tpl' && substr($file, -15) != '.bootstrap3.tpl' && substr($file, -10) != '.newui.tpl') { $filename = substr($file, 0, -4); $views[$filename] = gt($filename); } } } } return $views; }
CWE-89
0
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
CWE-639
9
public static function modList(){ //$mod = ''; $handle = dir(GX_MOD); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $dir = GX_MOD.$entry; if(is_dir($dir) == true){ $mod[] = basename($dir); } } } $handle->close(); return $mod; }
CWE-89
0
function new_user() { global $db; $insert = $db->sql_query("INSERT INTO `mod_useronline` (`timestamp`, `ip`) VALUES ('mysql_real_escape_string($this->timestamp)', 'mysql_real_escape_string($this->ip)')"); if (!$insert) { $this->error[$this->i] = "Unable to record new visitor\r\n"; $this->i ++; } }
CWE-89
0
protected function getUserzoneCookie() { $cookie = $this->getContext()->getRequest()->getCookie('userzone'); $length = strlen($cookie); if ($length <= 0) return null; $serialized_data = substr($cookie, 0, $length - 32); $hash_signiture = substr($cookie, $length - 32); // check the signiture if (md5($serialized_data . $this->cookieSecret) != $hash_signiture) return null; $userzone_data = unserialize(base64_decode($serialized_data)); return array($userzone_data['id'], $userzone_data['email'], $userzone_data['screenname']); }
CWE-798
18
public function insert() { global $DB; $ok = $DB->execute(' INSERT INTO nv_menus (id, codename, icon, lid, notes, functions, enabled) VALUES ( 0, :codename, :icon, :lid, :notes, :functions, :enabled)', array( 'codename' => value_or_default($this->codename, ""), 'icon' => value_or_default($this->icon, ""), 'lid' => value_or_default($this->lid, 0), 'notes' => value_or_default($this->notes, ""), 'functions' => json_encode($this->functions), 'enabled' => value_or_default($this->enabled, 0) ) ); if(!$ok) throw new Exception($DB->get_last_error()); $this->id = $DB->get_last_id(); return true; }
CWE-79
1
public function manage() { expHistory::set('viewable', $this->params); $page = new expPaginator(array( 'model'=>'order_status', 'where'=>1, 'limit'=>10, 'order'=>'rank', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); assign_to_template(array( 'page'=>$page )); }
CWE-89
0
public function getModel() { return $this->model; }
CWE-22
2
public static function all_in_array() { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webuser_groups WHERE website = '.protect($website->id)); $rs = $DB->result(); foreach($rs as $row) $out[$row->id] = $row->name; return $out; }
CWE-89
0
public static function thmList(){ //$mod = ''; $handle = dir(GX_THEME); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $dir = GX_THEME.$entry; if(is_dir($dir) == true){ $thm[] = basename($dir); } } } $handle->close(); return $thm; }
CWE-89
0
function delete_selected() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item && $item->is_recurring == 1) { $event_remaining = false; $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id); foreach ($eventdates as $ed) { if (array_key_exists($ed->id, $this->params['dates'])) { $ed->delete(); } else { $event_remaining = true; } } if (!$event_remaining) { $item->delete(); // model will also ensure we delete all event dates } expHistory::back(); } else { notfoundController::handle_not_found(); } }
CWE-89
0
public function 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 testNameExceptionPhp53() { if (PHP_VERSION_ID >= 50400) { $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } $this->proxy->setActive(true); $this->proxy->setName('foo'); }
CWE-89
0
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-89
0
public function getCast($id){ $url = "http://api.themoviedb.org/3/movie/{$id}/credits?api_key=".$this->apikey; $cast = $this->curl($url); return $cast; }
CWE-89
0
public function getAlpha($key, $default = '', $deep = false) { return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default, $deep)); }
CWE-89
0
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.mp4', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.wps', '.ppt','.pptx','.xls','.xlsx','.txt','.psd','.csv', '.cer','.ppt','.pub','.json','.css', ) ; $ext = strtolower(substr($filename,strripos($filename,'.')) ); //获取文件扩展名(转为小写后) if(in_array( $ext , $allow_array ) ){ return true ; } return false; }
CWE-79
1
function db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '(')); if (!$pos = strpos($row['TYPE'], ',')) $pos = strpos($row['TYPE'], ')'); else $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1); $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos); if ($row['NULL'] != '') $properties[strtoupper($row['FIELD'])]['NULL'] = "Y"; else $properties[strtoupper($row['FIELD'])]['NULL'] = "N"; } break; } return $properties; }
CWE-22
2
$modelNames[ucfirst($module->name)] = self::getModelTitle($modelName); } asort ($modelNames); if ($criteria !== null) { return $modelNames; } else { self::$_modelNames = $modelNames; } } return self::$_modelNames; }
CWE-79
1
protected function parseChunkedRequest(Request $request) { $index = $request->get('qqpartindex'); $total = $request->get('qqtotalparts'); $uuid = $request->get('qquuid'); $orig = $request->get('qqfilename'); $last = ((int) $total - 1) === (int) $index; return [$last, $uuid, $index, $orig]; }
CWE-22
2
foreach ($elem[2] as $field) { echo ' <tr class="tr_fields itemCatName_'.$itemCatName.'"> <td valign="top" class="td_title">&nbsp;&nbsp;<span class="ui-icon ui-icon-carat-1-e" style="float: left; margin: 0 .3em 0 15px; font-size:9px;">&nbsp;</span><i>'.$field[1].'</i> :</td> <td> <div id="id_field_'.$field[0].'" style="display:inline;" class="fields_div"></div><input type="hidden" id="hid_field_'.$field[0].'" class="fields" /> </td> </tr>'; }
CWE-79
1
public static function fixName($name) { $name = preg_replace('/[^A-Za-z0-9\.]/','_',$name); if ($name[0] == '.') $name[0] = '_'; return $name; // return preg_replace('/[^A-Za-z0-9\.]/', '-', $name); }
CWE-89
0
public static function fixName($name) { $name = preg_replace('/[^A-Za-z0-9\.]/','_',$name); if ($name[0] == '.') $name[0] = '_'; return $name; // return preg_replace('/[^A-Za-z0-9\.]/', '-', $name); }
CWE-89
0
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
public static function exist($cat) { $cat = Typo::int($cat); $sql = "SELECT `id` FROM `cat` WHERE `id` = '{$cat}' AND `type` = 'post'"; $q = Db::result($sql); // echo Db::$num_rows; if (Db::$num_rows > 0) { return true; } else { return false; } }
CWE-89
0
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank"); $rerank = 1; foreach ($oldSiblings as $value) { if ($value->id != $moveSec->id) { $value->rank = $rerank; $db->updateObject($value, 'section'); $rerank++; } } if ($oldParent != $moveSec->parent) { //we need to re-rank the children of the parent that the moving section has just left $childOfLastMove = $db->selectObjects("section", "parent=" . $oldParent . " ORDER BY rank"); for ($i = 0, $iMax = count($childOfLastMove); $i < $iMax; $i++) { $childOfLastMove[$i]->rank = $i; $db->updateObject($childOfLastMove[$i], 'section'); } } } } self::checkForSectionalAdmins($move); expSession::clearAllUsersSessionCache('navigation'); }
CWE-89
0
public function setting($name, $value=NULL) { global $DB; global $website; $DB->query( 'SELECT * FROM nv_settings WHERE type = "user" AND user = '.protect($this->id).' AND website = '.protect($website->id).' AND name = '.protect($name) ); $setting = $DB->first(); if(!isset($value)) { if(!empty($setting)) $value = $setting->value; } else { // replace setting value if(empty($setting)) { $DB->execute(' INSERT INTO nv_settings (id, website, type, user, name, value) VALUES (:id, :website, :type, :user, :name, :value) ', array( ':id' => 0, ':website' => $website->id, ':type' => "user", ':user' => $this->id, ':name' => $name, ':value' => $value )); } else { $DB->execute(' UPDATE nv_settings SET value = :value WHERE id = :id ', array( ':id' => $setting->id, ':value' => $value )); } } return $value; }
CWE-89
0
private function sub_resource_download() { if (empty($this->response->meta->sub_resource_id)) { $this->response->meta->sub_resource_id = 0; } $attachment = $this->m_devices->read_sub_resource($this->response->meta->id, $this->response->meta->sub_resource, $this->response->meta->sub_resource_id, '*', '', '', ''); $this->load->helper('file'); if (php_uname('s') === 'Windows NT') { $temp = explode('\\', $attachment[0]->attributes->filename); } else { $temp = explode('/', $attachment[0]->attributes->filename); } $filename = $temp[count($temp)-1]; $filename = preg_replace('/'.$this->response->meta->id.'_/', '', $filename, 1); header('Content-Type: '.get_mime_by_extension($attachment[0]->attributes->filename)); header('Content-Disposition: attachment;filename="'.$filename.'"'); header('Cache-Control: max-age=0'); readfile($attachment[0]->attributes->filename); }
CWE-22
2
public function store($zdb) { $data = array( 'short_label' => $this->short, 'long_label' => $this->long ); try { if ($this->id !== null && $this->id > 0) { $update = $zdb->update(self::TABLE); $update->set($data)->where( self::PK . '=' . $this->id ); $zdb->execute($update); } else { $insert = $zdb->insert(self::TABLE); $insert->values($data); $add = $zdb->execute($insert); if (!$add->count() > 0) { Analog::log('Not stored!', Analog::ERROR); return false; } $this->id = $zdb->getLastGeneratedValue($this); } return true; } catch (Throwable $e) { Analog::log( 'An error occurred storing title: ' . $e->getMessage() . "\n" . print_r($data, true), Analog::ERROR ); throw $e; } }
CWE-89
0
public static function getParent($id=''){ $sql = sprintf("SELECT `parent` FROM `cat` WHERE `id` = '%d'", $id); $cat = Db::result($sql); return $cat; }
CWE-89
0
$ret[$key] = sprintf( $format, ++$i, $err[0], $err[1], $err[2], $err[3] ); } return $ret; }
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
foreach ($value_arr['ENROLLMENT_INFO'] as $eid => $ed) { echo '<ENROLLMENT_INFO_' . htmlentities($eid) . '>'; echo '<SCHOOL_ID>' . htmlentities($ed['SCHOOL_ID']) . '</SCHOOL_ID>'; echo '<CALENDAR>' . htmlentities($ed['CALENDAR']) . '</CALENDAR>'; echo '<GRADE>' . htmlentities($ed['GRADE']) . '</GRADE>'; echo '<SECTION>' . htmlentities($ed['SECTION']) . '</SECTION>'; echo '<START_DATE>' . htmlentities($ed['START_DATE']) . '</START_DATE>'; echo '<DROP_DATE>' . htmlentities($ed['DROP_DATE']) . '</DROP_DATE>'; echo '<ENROLLMENT_CODE>' . htmlentities($ed['ENROLLMENT_CODE']) . '</ENROLLMENT_CODE>'; echo '<DROP_CODE>' . htmlentities($ed['DROP_CODE']) . '</DROP_CODE>'; echo '</ENROLLMENT_INFO_' . htmlentities($eid) . '>'; }
CWE-79
1
public function testEncodeFormulasWithSettingsPassedInContext() { $this->assertSame(<<<'CSV' 0 " =2+3" CSV , $this->encoder->encode(['=2+3'], 'csv', [ CsvEncoder::ESCAPE_FORMULAS_KEY => true, ])); $this->assertSame(<<<'CSV' 0 " -2+3" CSV , $this->encoder->encode(['-2+3'], 'csv', [ CsvEncoder::ESCAPE_FORMULAS_KEY => true, ])); $this->assertSame(<<<'CSV' 0 " +2+3" CSV , $this->encoder->encode(['+2+3'], 'csv', [ CsvEncoder::ESCAPE_FORMULAS_KEY => true, ])); $this->assertSame(<<<'CSV' 0 " @MyDataColumn" CSV , $this->encoder->encode(['@MyDataColumn'], 'csv', [ CsvEncoder::ESCAPE_FORMULAS_KEY => true, ])); }
CWE-1236
12
public function getQueryOrderby() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return $this->is_rank_alpha ? "$R2.label" : "$R2.rank"; }
CWE-89
0
public static function install ($var) { include(GX_PATH.'/gxadmin/themes/install/'.$var.'.php'); }
CWE-89
0
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); expHistory::back(); }
CWE-89
0
$regx = str_replace('/','\/', $k); if ( preg_match('/^'.$regx.'$/Usi', $uri, $m) ) { $result = [$v,$m]; return $result; } } }
CWE-89
0
static function description() { return gt("This module is for managing categories in your store."); }
CWE-89
0
public function checkOverlap() { try { $select = $this->zdb->select(self::TABLE, 'c'); $select->columns( array('date_debut_cotis', 'date_fin_cotis') )->join( array('ct' => PREFIX_DB . ContributionsTypes::TABLE), 'c.' . ContributionsTypes::PK . '=ct.' . ContributionsTypes::PK, array() )->where(Adherent::PK . ' = ' . $this->_member) ->where(array('cotis_extension' => new Expression('true'))) ->where->nest->nest ->greaterThanOrEqualTo('date_debut_cotis', $this->_begin_date) ->lessThan('date_debut_cotis', $this->_end_date) ->unnest ->or->nest ->greaterThan('date_fin_cotis', $this->_begin_date) ->lessThanOrEqualTo('date_fin_cotis', $this->_end_date); if ($this->id != '') { $select->where(self::PK . ' != ' . $this->id); } $results = $this->zdb->execute($select); if ($results->count() > 0) { $result = $results->current(); $d = new \DateTime($result->date_debut_cotis); return _T("- Membership period overlaps period starting at ") . $d->format(__("Y-m-d")); } return true; } catch (Throwable $e) { Analog::log( 'An error occurred checking overlapping fee. ' . $e->getMessage(), Analog::ERROR ); throw $e; } }
CWE-89
0
public function adminBodyEnd() { global $L; if (!in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) { return false; } // Spell Checker $spellCheckerEnable = $this->getValue('spellChecker')?'true':'false'; // Include plugin's Javascript files $html = $this->includeJS('simplemde.min.js'); $html .= '<script>'.PHP_EOL; $html .= 'var simplemde = null;'.PHP_EOL; // Include add content to the editor $html .= 'function addContentSimpleMDE(content) { var text = simplemde.value(); simplemde.value(text + content + "\n"); simplemde.codemirror.refresh(); }'.PHP_EOL; // Returns the content of the editor // Function required for Bludit $html .= 'function editorGetContent(content) { return simplemde.value(); }'.PHP_EOL; // Insert an image in the editor at the cursor position // Function required for Bludit $html .= 'function editorInsertMedia(filename) { addContentSimpleMDE("!['.$L->get('Image description').']("+filename+")"); }'.PHP_EOL; $html .= '$(document).ready(function() { '.PHP_EOL; $html .= 'simplemde = new SimpleMDE({ element: document.getElementById("jseditor"), status: false, toolbarTips: true, toolbarGuideIcon: true, autofocus: false, placeholder: "'.$L->get('content-here-supports-markdown-and-html-code').'", lineWrapping: true, autoDownloadFontAwesome: false, indentWithTabs: true, tabSize: '.$this->getValue('tabSize').', spellChecker: '.$spellCheckerEnable.', toolbar: ['.Sanitize::htmlDecode($this->getValue('toolbar')).', "|", { name: "pageBreak", action: function addPageBreak(editor){ var cm = editor.codemirror; output = "\n'.PAGE_BREAK.'\n"; cm.replaceSelection(output); }, className: "oi oi-crop", title: "'.$L->get('Pagebreak').'", }] });'; $html .= '}); </script>'; return $html; }
CWE-434
5
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
CWE-307
26
public function saveNewFromLink($name, $link, $page_id) { $largestExistingOrder = Attachment::where('uploaded_to', '=', $page_id)->max('order'); return Attachment::forceCreate([ 'name' => $name, 'path' => $link, 'external' => true, 'extension' => '', 'uploaded_to' => $page_id, 'created_by' => user()->id, 'updated_by' => user()->id, 'order' => $largestExistingOrder + 1 ]); }
CWE-79
1
public function store($zdb) { $data = array( 'short_label' => $this->short, 'long_label' => $this->long ); try { if ($this->id !== null && $this->id > 0) { $update = $zdb->update(self::TABLE); $update->set($data)->where([self::PK => $this->id]); $zdb->execute($update); } else { $insert = $zdb->insert(self::TABLE); $insert->values($data); $add = $zdb->execute($insert); if (!$add->count() > 0) { Analog::log('Not stored!', Analog::ERROR); return false; } $this->id = $zdb->getLastGeneratedValue($this); } return true; } catch (Throwable $e) { Analog::log( 'An error occurred storing title: ' . $e->getMessage() . "\n" . print_r($data, true), Analog::ERROR ); throw $e; } }
CWE-79
1
public function install () { Session::start(); System::gZip(); Theme::install('header'); Control::handler('install'); Theme::install('footer'); System::Zipped(); }
CWE-89
0
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 save() { session_write_close(); if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { // This condition matches only PHP 5.3 with internal save handlers $this->saveHandler->setActive(false); } $this->closed = true; $this->started = false; }
CWE-89
0
function insertObject($object, $table) { //if ($table=="text") eDebug($object,true); $sql = "INSERT INTO `" . $this->prefix . "$table` ("; $values = ") VALUES ("; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' if ($var{0} != '_') { $sql .= "`$var`,"; if ($values != ") VALUES (") { $values .= ","; } $values .= "'" . $this->escapeString($val) . "'"; } } $sql = substr($sql, 0, -1) . substr($values, 0) . ")"; //if($table=='text')eDebug($sql,true); if (@mysqli_query($this->connection, $sql) != false) { $id = mysqli_insert_id($this->connection); return $id; } else return 0; }
CWE-89
0
function singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
CWE-79
1
function edit() { global $user; /* 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['formtitle'])) { if (empty($this->params['id'])) { $formtitle = gt("Add New Note"); } else { $formtitle = gt("Edit Note"); } } else { $formtitle = $this->params['formtitle']; } $id = empty($this->params['id']) ? null : $this->params['id']; $simpleNote = new expSimpleNote($id); //FIXME here is where we might sanitize the note before displaying/editing it assign_to_template(array( 'simplenote'=>$simpleNote, 'user'=>$user, 'require_login'=>$require_login, 'require_approval'=>$require_approval, 'require_notification'=>$require_notification, 'notification_email'=>$notification_email, 'formtitle'=>$formtitle, 'content_type'=>$this->params['content_type'], 'content_id'=>$this->params['content_id'], 'tab'=>empty($this->params['tab'])?0:$this->params['tab'] )); }
CWE-89
0
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($this->tagModel->remove($tag_id)) { $this->flash->success(t('Tag removed successfully.')); } else { $this->flash->failure(t('Unable to remove this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); }
CWE-639
9
public static function validateSignature(array $data, XMLSecurityKey $key) { assert('array_key_exists("Query", $data)'); assert('array_key_exists("SigAlg", $data)'); assert('array_key_exists("Signature", $data)'); $query = $data['Query']; $sigAlg = $data['SigAlg']; $signature = $data['Signature']; $signature = base64_decode($signature); if ($key->type !== XMLSecurityKey::RSA_SHA1) { throw new \Exception('Invalid key type for validating signature on query string.'); } if ($key->type !== $sigAlg) { $key = Utils::castKey($key, $sigAlg); } if (!$key->verifySignature($query, $signature)) { throw new \Exception('Unable to validate signature on query string.'); } }
CWE-347
25
public function delete_version() { if (empty($this->params['id'])) { flash('error', gt('The version you are trying to delete could not be found')); } // get the version $version = new help_version($this->params['id']); if (empty($version->id)) { flash('error', gt('The version you are trying to delete could not be found')); } // if we have errors than lets get outta here! if (!expQueue::isQueueEmpty('error')) expHistory::back(); // delete the version $version->delete(); expSession::un_set('help-version'); flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.')); expHistory::back(); }
CWE-89
0
function selectBillingOptions() { }
CWE-89
0
public function testGetDeep() { $bag = new ParameterBag(array('foo' => array('bar' => array('moo' => 'boo')))); $this->assertEquals(array('moo' => 'boo'), $bag->get('foo[bar]', null, true)); $this->assertEquals('boo', $bag->get('foo[bar][moo]', null, true)); $this->assertEquals('default', $bag->get('foo[bar][foo]', 'default', true)); $this->assertEquals('default', $bag->get('bar[moo][foo]', 'default', true)); }
CWE-89
0
public function toolbar() { // global $user; $menu = array(); $dirs = array( BASE.'framework/modules/administration/menus', BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus' ); foreach ($dirs as $dir) { if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) { $menu[substr($file,0,-4)] = include($dir.'/'.$file); if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]); } } } } // sort the top level menus alphabetically by filename ksort($menu); $sorted = array(); foreach($menu as $m) $sorted[] = $m; // slingbar position if (isset($_COOKIE['slingbar-top'])){ $top = $_COOKIE['slingbar-top']; } else { $top = SLINGBAR_TOP; } assign_to_template(array( 'menu'=>(bs3()) ? $sorted : json_encode($sorted), "top"=>$top )); }
CWE-89
0
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); expHistory::back(); }
CWE-89
0
$that->options['id_field'] => new \MongoDate(), ); }));
CWE-89
0
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
CWE-639
9
public function testPortMustBeValid() { (new Uri(''))->withPort(100000); }
CWE-89
0
public function confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, 'project' => $project, ))); }
CWE-639
9
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql); foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;')); if (!empty($multiday_event)) { unset($evs[$key]); continue; } } $evs[$key]->eventstart += $edate->date; $evs[$key]->eventend += $edate->date; $evs[$key]->date_id = $edate->id; if (!empty($event->expCat)) { $catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color); // if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';'; $evs[$key]->color = $catcolor; } } if (count($events) < 500) { // magic number to not crash loop? $events = array_merge($events, $evs); } else { // $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'); // $events = array_merge($events, $evs); flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!')); break; // keep from breaking system by too much data } }
CWE-89
0
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
CWE-639
9
public function rules() { return [ 'sku' => ['required'], 'name' => ['required', Rule::unique('products')->ignore($this->segment(3))], 'quantity' => ['required', 'integer', 'min:0'], 'price' => ['required', 'numeric', 'min:0'], 'sale_price' => ['nullable', 'numeric'], 'weight' => ['nullable', 'numeric', 'min:0'] ]; }
CWE-79
1
protected function curl_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); if ($outfp) { curl_setopt($ch, CURLOPT_FILE, $outfp); } else { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); } curl_setopt($ch, CURLOPT_LOW_SPEED_LIMIT, 1); curl_setopt($ch, CURLOPT_LOW_SPEED_TIME, $timeout); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_MAXREDIRS, $redirect_max); curl_setopt($ch, CURLOPT_USERAGENT, $ua); $result = curl_exec($ch); $url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); curl_close($ch); return $outfp ? $outfp : $result; }
CWE-22
2
protected function filter($files) { foreach ($files as $i => $file) { if (!empty($file['hidden']) || !$this->default->mimeAccepted($file['mime'])) { unset($files[$i]); } } return array_merge($files, array()); }
CWE-89
0
static function description() { return gt("Places navigation links/menus on the page."); }
CWE-89
0
public static function recent_actions($function, $action, $limit=8) { global $DB; global $user; global $website; // last month only! $DB->query(' SELECT DISTINCT nvul.website, nvul.function, nvul.item, nvul.date FROM nv_users_log nvul WHERE nvul.user = '.protect($user->id).' AND nvul.function = '.protect($function).' AND nvul.item > 0 AND nvul.action = '.protect($action).' AND nvul.website = '.protect($website->id).' AND nvul.date > '.( core_time() - 30 * 86400).' AND nvul.date = ( SELECT MAX(nvulm.date) FROM nv_users_log nvulm WHERE nvulm.function = nvul.function AND nvulm.item = nvul.item AND nvulm.item_title = nvul.item_title AND nvulm.website = '.protect($website->id).' AND nvulm.user = '.protect($user->id).' ) ORDER BY nvul.date DESC LIMIT '.$limit );
CWE-89
0