code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_restriction/show', array(
'status_list' => array(
SubtaskModel::STATUS_TODO => t('Todo'),
SubtaskModel::STATUS_DONE => t('Done'),
),
'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
public function getQueryGroupby()
{
$R = 'R_' . $this->id;
return "$R.value_id";
} | CWE-89 | 0 |
public function destroy($sessionId)
{
$this->getCollection()->remove(array(
$this->options['id_field'] => $sessionId,
));
return true;
} | CWE-89 | 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-639 | 9 |
public function testPostRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId)
{
$request = new Enlight_Controller_Request_RequestTestCase();
$request->setMethod('POST');
$response = new Enlight_Controller_Response_ResponseTestCase();
$request->setPathInfo($uri);
$this->router->assembleRoute($request, $response);
static::assertEquals($expectedController, $request->getControllerName());
static::assertEquals($expectedAction, $request->getActionName());
static::assertEquals($expectedVersion, $request->getParam('version'));
static::assertEquals($expectedId, $request->getParam('id'));
} | CWE-601 | 11 |
function import() {
$pullable_modules = expModules::listInstalledControllers($this->baseclassname);
$modules = new expPaginator(array(
'records' => $pullable_modules,
'controller' => $this->loc->mod,
'action' => $this->params['action'],
'order' => isset($this->params['order']) ? $this->params['order'] : 'section',
'dir' => isset($this->params['dir']) ? $this->params['dir'] : '',
'page' => (isset($this->params['page']) ? $this->params['page'] : 1),
'columns' => array(
gt('Title') => 'title',
gt('Page') => 'section'
),
));
assign_to_template(array(
'modules' => $modules,
));
}
| CWE-89 | 0 |
public function approve_submit() {
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
$comment = new expComment($this->params['id']);
$comment->body = $this->params['body'];
$comment->approved = $this->params['approved'];
$comment->save();
expHistory::back();
} | CWE-89 | 0 |
public function getQuerySelect()
{
$R1 = 'R1_' . $this->id;
$R2 = 'R2_' . $this->id;
return "$R2.value AS `" . $this->name . "`";
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('SELECT * FROM nv_files WHERE website = '.protect($website->id), 'object');
$out = $DB->result();
if($type='json')
$out = json_encode($out);
return $out;
}
| CWE-89 | 0 |
static function displayname() {
return "Events";
}
| 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 add($tags) {
$tag = explode(",", $tags);
foreach ($tag as $t) {
if (self::exist($t)) {
return false;
}else{
$slug = Typo::slugify(Typo::cleanX($t));
$cat = Typo::cleanX($t);
$tag = Db::insert(
sprintf("INSERT INTO `cat` VALUES (null, '%s', '%s', '%d', '', 'tag' )",
$cat, $slug, 0
)
);
return true;
}
}
}
| CWE-89 | 0 |
public function getBoolean($key, $default = false, $deep = false)
{
return $this->filter($key, $default, FILTER_VALIDATE_BOOLEAN, array(), $deep);
} | CWE-89 | 0 |
function manage() {
global $db, $router, $user;
expHistory::set('manageable', $router->params);
assign_to_template(array(
'canManageStandalones' => self::canManageStandalones(),
'sasections' => $db->selectObjects('section', 'parent=-1'),
'user' => $user,
// 'canManagePagesets' => $user->isAdmin(),
// 'templates' => $db->selectObjects('section_template', 'parent=0'),
));
}
| CWE-89 | 0 |
public function from($dirName)
{
$this->from = $dirName;
return $this;
} | CWE-79 | 1 |
function edit() {
if (empty($this->params['content_id'])) {
flash('message',gt('An error occurred: No content id set.'));
expHistory::back();
}
/* The global constants can be overridden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
$id = empty($this->params['id']) ? null : $this->params['id'];
$comment = new expComment($id);
//FIXME here is where we might sanitize the comment before displaying/editing it
assign_to_template(array(
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'comment'=>$comment
));
} | CWE-89 | 0 |
function phoromatic_webui_header($left_items, $right = null)
{
$ret = PHP_EOL . '<div id="pts_phoromatic_top_header">
<ul>
<li><a href="?"><img style="vertical-align: middle;" class="img_logo_pg" src="images/phoromatic_logo.svg" /></a>';
if(isset($_SESSION['AdminLevel']) &&$_SESSION['AdminLevel'] > 0 && isset($_SESSION['AccountID']) && !empty($_SESSION['AccountID']))
{
$ret .= '<ul id="pts_phoromatic_info">';
$ret .= '<li><a class="ph_date" href="#">' . date('H:i T - j F') . '</a></li>';
$group_name = phoromatic_account_id_to_group_name($_SESSION['AccountID']);
if($group_name != null)
{
$ret .= '<li><a href="#">' . $group_name . '</a></li>';
}
$ret .= '</ul>';
}
$ret .= '</li>';
//$ret .= '<ul>';
foreach($left_items as $i => $item)
{
if(is_array($item))
{
$ret .= '<li>' . $i;
if(!empty($item))
{
$ret .= '<ul>';
foreach($item as $sub_item)
{
$ret .= '<li>' . $sub_item . '</li>';
}
$ret .= '</ul>';
}
$ret .= '</li>' . PHP_EOL;
}
else
{
$ret .= '<li>' . $item . '</li>' . PHP_EOL;
}
}
$ret .= '<li><div id="phoromatic_result_selected_info_box"></div> <a href="#" onclick="javascript:phoromatic_generate_comparison(\'?result/\');"><div id="phoromatic_result_compare_info_box">Compare</div></a> <a href="#" onclick="javascript:phoromatic_delete_results(\'?results/delete/\'); return false;"><div id="phoromatic_result_delete_box">Delete</div></a></li>';
$ret .= '</ul>';
if($right != null)
{
$ret .= '<div id="pts_phoromatic_top_header_right">' . $right .'</div>';
}
$ret .=' </div>';
return $ret;
} | CWE-79 | 1 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($this->tagModel->remove($tag_id)) {
$this->flash->success(t('Tag removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public static function 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-89 | 0 |
protected function itemLocked($hash)
{
if (!elFinder::$commonTempPath) {
return false;
}
$lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock';
if (file_exists($lock)) {
if (filemtime($lock) + $this->itemLockExpire < time()) {
unlink($lock);
return false;
}
return true;
}
return false;
} | CWE-918 | 16 |
form_end_row();
$i++;
}
html_end_box(false);
/*
print "<pre>";
if (isset($check) && is_array($check)) {
print_r($check);
}
print "</pre>";
*/
} | CWE-79 | 1 |
public function tmb($hash) {
$path = $this->decode($hash);
$stat = $this->stat($path);
if (isset($stat['tmb'])) {
return $stat['tmb'] == "1" ? $this->createTmb($path, $stat) : $stat['tmb'];
}
return false;
} | CWE-89 | 0 |
public function getQuerySelect()
{
return '';
} | CWE-89 | 0 |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | CWE-22 | 2 |
foreach ($events as $event) {
$extevents[$date][] = $event;
}
| CWE-89 | 0 |
public static function login() {
user::login(expString::sanitize($_POST['username']),expString::sanitize($_POST['password']));
if (!isset($_SESSION[SYS_SESSION_KEY]['user'])) { // didn't successfully log in
flash('error', gt('Invalid Username / Password'));
if (expSession::is_set('redirecturl_error')) {
$url = expSession::get('redirecturl_error');
expSession::un_set('redirecturl_error');
header("Location: ".$url);
} else {
expHistory::back();
}
} else { // we're logged in
global $user;
if (expSession::get('customer-login')) expSession::un_set('customer-login');
if (!empty($_POST['username'])) flash('message', gt('Welcome back').' '.expString::sanitize($_POST['username']));
if ($user->isAdmin()) {
expHistory::back();
} else {
foreach ($user->groups as $g) {
if (!empty($g->redirect)) {
$url = URL_FULL.$g->redirect;
break;
}
}
if (isset($url)) {
header("Location: ".$url);
} else {
expHistory::back();
}
}
}
} | CWE-89 | 0 |
public function approvedFileExtension($filename, $type = 'image')
{
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
if ($type == 'image') {
switch ($ext) {
case 'gif':
case 'png':
case 'jpeg':
case 'jpg':
case 'svg':
return true;
default:
return false;
}
} elseif ($type == 'cert') {
switch ($ext) {
case 'pem':
return true;
default:
return false;
}
}
} | CWE-434 | 5 |
public function __construct($message, $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
} | CWE-307 | 26 |
function updateCommandCategorieInDB(){
global $pearDB;
$DBRESULT = $pearDB->query("UPDATE `command_categories` SET `category_name` = '".$_POST["category_name"]."' , `category_alias` = '".$_POST["category_alias"]."' , `category_order` = '".$_POST["category_order"]."' WHERE `cmd_category_id` = '".$_POST["cmd_category_id"]."'");
} | CWE-94 | 14 |
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-79 | 1 |
public function update()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->swimlaneValidator->validateModification($values);
if ($valid) {
if ($this->swimlaneModel->update($values['id'], $values)) {
$this->flash->success(t('Swimlane updated successfully.'));
return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} else {
$errors = array('name' => array(t('Another swimlane with the same name exists in the project')));
}
}
return $this->edit($values, $errors);
} | CWE-639 | 9 |
public function confirm()
{
$project = $this->getProject();
$this->response->html($this->helper->layout->project('action/remove', array(
'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')),
'available_events' => $this->eventManager->getAll(),
'available_actions' => $this->actionManager->getAvailableActions(),
'project' => $project,
'title' => t('Remove an action')
)));
} | CWE-639 | 9 |
public function __invoke(Request $request)
{
$this->authorize('manage modules');
$path = ModuleInstaller::unzip($request->module, $request->path);
return response()->json([
'success' => true,
'path' => $path
]);
} | CWE-502 | 15 |
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 object_votes_by_webuser($object, $object_id, $orderby='date desc', $offset=0, $limit=PHP_INT_MAX)
{
global $DB;
global $website;
$DB->queryLimit('wuv.id AS id, wuv.date AS date, wuv.webuser AS webuser, wu.username AS username',
'nv_webuser_votes wuv, nv_webusers wu',
' wuv.website = '.protect($website->id).'
AND wuv.object = '.protect($object).'
AND wuv.object_id = '.protect($object_id).'
AND wu.id = wuv.webuser',
$orderby,
$offset,
$limit);
return array($DB->result(), $DB->foundRows());
}
| CWE-89 | 0 |
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_converter/show', array(
'subtask' => $subtask,
'task' => $task,
)));
} | CWE-639 | 9 |
private function getTaskLink()
{
$link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id'));
if (empty($link)) {
throw new PageNotFoundException();
}
return $link;
} | CWE-639 | 9 |
static function author() {
return "Dave Leffler";
}
| CWE-89 | 0 |
public function edit(Request $request, $id) {
return $this->view('content::admin.content.edit', [
'content_id'=>$id
]);
} | CWE-79 | 1 |
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId());
$this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']);
} | CWE-639 | 9 |
public static function delParam($param, $post_id) {
$sql = "DELETE FROM `posts_param` WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' LIMIT 1";
$q = Db::query($sql);
if ($q) {
return true;
}else{
return false;
}
}
| CWE-89 | 0 |
public static function cat($vars) {
switch (SMART_URL) {
case true:
# code...
$url = Options::get('siteurl')."/".$vars."/".Typo::slugify(Categories::name($vars));
break;
default:
# code...
$url = Options::get('siteurl')."/index.php?cat={$vars}";
break;
}
return $url;
} | CWE-89 | 0 |
private function encloseForCSV($field)
{
return '"' . cleanCSV($field) . '"';
} | CWE-640 | 20 |
public static function addParam($param, $value, $post_id) {
$sql = array(
'table' => 'posts_param',
'key' => array(
'post_id' => $post_id,
'param' => $param,
'value' => $value
)
);
$q = Db::insert($sql);
if ($q) {
return true;
}else{
return false;
}
}
| CWE-89 | 0 |
public function authenticate_by_email($website, $email, $password)
{
global $DB;
// find the webuser username assigned to an email address
// because it may exist more than one account with the same email,
// only the first _created_ will be used
$username = $DB->query_single(
'username',
'nv_webusers',
'website = '.intval($website).' AND email = '.protect($email)
);
if(empty($username))
return false;
return $this->authenticate($website, $username, $password);
}
| CWE-89 | 0 |
protected function decodeData($data)
{
if ($this->base64encode) {
if (is_string($data)) {
if (($data = base64_decode($data)) !== false) {
$data = @unserialize($data);
} else {
$data = null;
}
} else {
$data = null;
}
}
return $data;
} | CWE-89 | 0 |
public function saveConfig() {
if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) {
if ($this->params['order'] == 'rank ASC') {
expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params);
}
}
parent::saveConfig();
} | CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('SELECT * FROM nv_structure WHERE website = '.protect($website->id), 'object');
if($type='json')
$out = json_encode($DB->result());
return $out;
}
| CWE-89 | 0 |
public static function parseAndTrim($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
// global $db;
$str = str_replace("�", "’", $str);
$str = str_replace("�", "‘", $str);
$str = str_replace("�", "®", $str);
$str = str_replace("�", "-", $str);
$str = str_replace("�", "—", $str);
$str = str_replace("�", "”", $str);
$str = str_replace("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
//$str = str_replace(",","\,",$str);
$str = str_replace('\"', """, $str);
$str = str_replace('"', """, $str);
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
// if (DB_ENGINE=='mysqli') {
// $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "™", $str)));
// } elseif(DB_ENGINE=='mysql') {
// $str = @mysql_real_escape_string(trim(str_replace("�", "™", $str)),$db->connection);
// } else {
// $str = trim(str_replace("�", "™", $str));
// }
$str = @expString::escape(trim(str_replace("�", "™", $str)));
//echo "2<br>"; eDebug($str,die);
return $str;
} | CWE-89 | 0 |
public function &storeicms_ipf_Object($debug=false, $xparam = false) {
$ret =& $this->storeFromDefaultForm('', '', null, $debug, $xparam);
return $ret;
}
| CWE-22 | 2 |
public function testRedirectLinkGeneration () {
Yii::app()->controller = new MarketingController (
'campaign', new MarketingModule ('campaign', null));
$_SERVER['SERVER_NAME'] = 'localhost';
$cmb = $this->instantiate();
$contact = $this->contacts('testUser_unsent');
$campaign = $this->campaign('redirectLinkGeneration');
$url = preg_replace ('/^[^"]*"([^"]*)".*$/', '$1', $campaign->content);
list($subject,$message,$uniqueId) = $cmb->prepareEmail(
$this->campaign('redirectLinkGeneration'),
$contact,$this->listItem('testUser_unsent')->emailAddress);
$this->assertRegExp ('/'.preg_quote (urlencode ($url)).'/', $message);
} | CWE-79 | 1 |
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] : ($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber())) && false ?: '_'}); | CWE-89 | 0 |
function db_start()
{
global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;
switch ($DatabaseType) {
case 'mysqli':
$connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);
break;
}
// Error code for both.
if ($connection === false) {
switch ($DatabaseType) {
case 'mysqli':
$errormessage = mysqli_error($connection);
break;
}
db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errormessage);
}
return $connection;
} | CWE-22 | 2 |
public function event()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id'])) {
return $this->create();
}
return $this->response->html($this->template->render('action_creation/event', array(
'values' => $values,
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | CWE-639 | 9 |
public function getEditLanguageLink($icmsObj, $onlyUrl=false, $withimage=true) {
$ret = $this->handler->_moduleUrl . "admin/"
. $this->handler->_page
. "?op=mod&" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName)
. "&language=" . $icmsObj->getVar('language');
if ($onlyUrl) {
return $ret;
} elseif ($withimage) {
return "<a href='" . $ret . "'>
<img src='" . ICMS_IMAGES_SET_URL . "/actions/wizard.png' style='vertical-align: middle;' alt='"
. _CO_ICMS_LANGUAGE_MODIFY . "' title='" . _CO_ICMS_LANGUAGE_MODIFY . "'/></a>";
}
return "<a href='" . $ret . "'>" . $icmsObj->getVar($this->handler->identifierName) . "</a>";
}
| CWE-22 | 2 |
function getTextColumns($table) {
$sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'";
$res = @mysqli_query($this->connection, $sql);
if ($res == null)
return array();
$records = array();
while($row = mysqli_fetch_object($res)) {
$records[] = $row->Field;
}
return $records;
} | CWE-89 | 0 |
$result = $search->getSearchResults($item->query, false, true);
if(empty($result) && !in_array($item->query, $badSearchArr)) {
$badSearchArr[] = $item->query;
$badSearch[$ctr2]['query'] = $item->query;
$badSearch[$ctr2]['count'] = $db->countObjects("search_queries", "query='{$item->query}'");
$ctr2++;
}
}
//Check if the user choose from the dropdown
if(!empty($user_default)) {
if($user_default == $anonymous) {
$u_id = 0;
} else {
$u_id = $user_default;
}
$where .= "user_id = {$u_id}";
}
//Get all the search query records
$records = $db->selectObjects('search_queries', $where);
for ($i = 0, $iMax = count($records); $i < $iMax; $i++) {
if(!empty($records[$i]->user_id)) {
$u = user::getUserById($records[$i]->user_id);
$records[$i]->user = $u->firstname . ' ' . $u->lastname;
}
}
$page = new expPaginator(array(
'records' => $records,
'where'=>1,
'model'=>'search_queries',
'limit'=>(isset($this->config['limit']) && $this->config['limit'] != '') ? 10 : $this->config['limit'],
'order'=>empty($this->config['order']) ? 'timestamp' : $this->config['order'],
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'columns'=>array(
'ID'=>'id',
gt('Query')=>'query',
gt('Timestamp')=>'timestamp',
gt('User')=>'user_id',
),
));
$uname['id'] = implode($uname['id'],',');
$uname['name'] = implode($uname['name'],',');
assign_to_template(array(
'page'=>$page,
'users'=>$uname,
'user_default' => $user_default,
'badSearch' => $badSearch
));
} | CWE-89 | 0 |
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 |
unset($return[$key]);
}
}
break;
}
return @array_change_key_case($return, CASE_UPPER);
} | CWE-79 | 1 |
public function handleObjectDeletion($confirm_msg = false, $op='del', $userSide=false) {
global $impresscms;
$objectid = (isset($_REQUEST[$this->handler->keyName])) ? (int) $_REQUEST[$this->handler->keyName] : 0;
$icmsObj = $this->handler->get($objectid);
if ($icmsObj->isNew()) {
redirect_header("javascript:history.go(-1)", 3, _CO_ICMS_NOT_SELECTED);
exit();
}
$confirm = ( isset($_POST['confirm']) ) ? $_POST['confirm'] : 0;
if ($confirm) {
if (!$this->handler->delete($icmsObj)) {
redirect_header($_POST['redirect_page'], 3, _CO_ICMS_DELETE_ERROR . $icmsObj->getHtmlErrors());
exit;
}
redirect_header($_POST['redirect_page'], 3, _CO_ICMS_DELETE_SUCCESS);
exit();
} else {
// no confirm: show deletion condition
icms_cp_header();
if (!$confirm_msg) {
$confirm_msg = _CO_ICMS_DELETE_CONFIRM;
}
$hiddens = array(
'op' => $op,
$this->handler->keyName => $icmsObj->getVar($this->handler->keyName),
'confirm' => 1,
'redirect_page' => $impresscms->urls['previouspage']
);
if ($this->handler->_moduleName == 'system') {
$hiddens['fct'] = isset($_GET['fct']) ? $_GET['fct'] : false;
}
icms_core_Message::confirm($hiddens, xoops_getenv('SCRIPT_NAME'), sprintf($confirm_msg , $icmsObj->getVar($this->handler->identifierName)), _CO_ICMS_DELETE);
icms_cp_footer();
}
exit();
}
| CWE-22 | 2 |
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 |
protected function setUp()
{
parent::setUp();
$mongoClass = version_compare(phpversion('mongo'), '1.3.0', '<') ? 'Mongo' : 'MongoClient';
$this->mongo = $this->getMockBuilder($mongoClass)
->disableOriginalConstructor()
->getMock();
$this->options = array(
'id_field' => '_id',
'data_field' => 'data',
'time_field' => 'time',
'expiry_field' => 'expires_at',
'database' => 'sf2-test',
'collection' => 'session-test',
);
$this->storage = new MongoDbSessionHandler($this->mongo, $this->options);
} | CWE-89 | 0 |
foreach ($nodes as $node) {
if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) {
if ($node->active == 1) {
$text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . $node->name;
} else {
$text = str_pad('', ($depth + ($full ? 1 : 0)) * 3, '.', STR_PAD_LEFT) . '(' . $node->name . ')';
}
$ar[$node->id] = $text;
foreach (self::levelDropdownControlArray($node->id, $depth + 1, $ignore_ids, $full, $perm, $addstandalones, $addinternalalias) as $id => $text) {
$ar[$id] = $text;
}
}
}
| CWE-89 | 0 |
private function invertedSection($nodes, $id, $filters, $level)
{
$method = $this->getFindMethod($id);
$id = var_export($id, true);
$filters = $this->getFilters($filters, $level);
return sprintf($this->prepare(self::INVERTED_SECTION, $level), $id, $method, $id, $filters, $this->walk($nodes, $level));
} | CWE-1336 | 30 |
protected function _move($source, $targetDir, $name) {
$sql = 'UPDATE %s SET parent_id=%d, name="%s" WHERE id=%d LIMIT 1';
$sql = sprintf($sql, $this->tbf, $targetDir, $this->db->real_escape_string($name), $source);
return $this->query($sql) && $this->db->affected_rows > 0 ? $source : false;
} | CWE-89 | 0 |
function process_subsections($parent_section, $subtpl) {
global $db, $router;
$section = new stdClass();
$section->parent = $parent_section->id;
$section->name = $subtpl->name;
$section->sef_name = $router->encode($section->name);
$section->subtheme = $subtpl->subtheme;
$section->active = $subtpl->active;
$section->public = $subtpl->public;
$section->rank = $subtpl->rank;
$section->page_title = $subtpl->page_title;
$section->keywords = $subtpl->keywords;
$section->description = $subtpl->description;
$section->id = $db->insertObject($section, 'section');
self::process_section($section, $subtpl);
}
| CWE-89 | 0 |
public static function cat($vars) {
switch (SMART_URL) {
case true:
# code...
$inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":"";
$url = Site::$url.$inFold."/category/".$vars."/".Typo::slugify(Categories::name($vars));
break;
default:
# code...
$url = Site::$url."/?cat={$vars}";
break;
}
return $url;
}
| CWE-89 | 0 |
public function transformAssignedTo($asset)
{
if ($asset->checkedOutToUser()) {
return $asset->assigned ? [
'id' => (int) $asset->assigned->id,
'username' => e($asset->assigned->username),
'name' => e($asset->assigned->getFullNameAttribute()),
'first_name'=> e($asset->assigned->first_name),
'last_name'=> ($asset->assigned->last_name) ? e($asset->assigned->last_name) : null,
'employee_number' => ($asset->assigned->employee_num) ? e($asset->assigned->employee_num) : null,
'type' => 'user'
] : null;
}
return $asset->assigned ? [
'id' => $asset->assigned->id,
'name' => $asset->assigned->display_name,
'type' => $asset->assignedType()
] : null;
} | CWE-79 | 1 |
function get_allowed_files_extensions_for_upload($fileTypes = 'images', $returnAsArray = false)
{
$are_allowed = '';
switch ($fileTypes) {
case 'img':
case 'image':
case 'images':
$are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg,webp,ico';
break;
case 'audio':
case 'audios':
$are_allowed .= ',mp3,mp4,ogg,wav,flac';
break;
case 'video':
case 'videos':
$are_allowed .= ',avi,asf,mpg,mpeg,mp4,flv,mkv,webm,ogg,ogv,3gp,3g2,wma,mov,wmv';
break;
case 'file':
case 'files':
$are_allowed .= ',doc,docx,pdf,json,rtf,txt,zip,gzip,rar,cad,xml,psd,xlsx,csv,7z';
break;
case 'documents':
case 'doc':
$are_allowed .= ',doc,docx,pdf,log,msg,odt,pages,rtf,tex,txt,wpd,wps,pps,ppt,pptx,xml,xlr,xls,xlsx';
break;
case 'archives':
case 'arc':
case 'arch':
$are_allowed .= ',zip,zipx,gzip,rar,gz,7z,cbr,tar.gz';
break;
case 'all':
$are_allowed .= ',*';
break;
case '*':
$are_allowed .= ',*';
break;
default:
$are_allowed .= ',' . $fileTypes;
}
if($are_allowed){
$are_allowed = explode(',',$are_allowed);
array_unique($are_allowed);
$are_allowed = array_filter($are_allowed);
if ($returnAsArray) {
return $are_allowed;
}
$are_allowed = implode(',', $are_allowed);
}
if ($returnAsArray) {
return [];
}
return $are_allowed;
} | CWE-79 | 1 |
public function getQuerySelect()
{
$R = 'R_' . $this->id;
return "$R.value_id AS `" . $this->name . "`";
} | CWE-89 | 0 |
private function add_timeout(RequestInterface $request, &$options, $value, &$params)
{
$options['http']['timeout'] = $value;
} | CWE-89 | 0 |
public function redeemable($cart, $webuser)
{
global $website;
global $DB;
// 1/ coupon matches the current website
$redeemable = true;
if($this->website != $website->id)
$redeemable = false;
// 2/ coupon currency matches the current cart currency
if($this->currency != $cart['currency'])
$redeemable = false;
// 3/ check dates
$now = core_time();
if( !empty($this->date_begin) && $now < $this->date_begin)
$redeemable = false;
if( !empty($this->date_end) && $now > $this->date_end)
$redeemable = false;
// 4/ minimum spend
// TODO: check currencies?
if( !empty($this->minimum_spend) && $cart['subtotal'] < $this->minimum_spend )
$redeemable = false;
// 5/ check webuser usage
if( !empty($this->times_allowed_customer) )
{
$times_used_by_customer = $DB->query_single(
'COUNT(*)',
'nv_orders',
'
website = '.protect($website->id).' AND
webuser = '.protect($webuser).' AND
coupon = '.protect($this->id)
);
if($times_used_by_customer > $this->times_allowed_customer)
$redeemable = false;
}
// 6/ check global orders usage
if( !empty($this->times_allowed_globally) )
{
$times_used_globally = $DB->query_single(
'COUNT(*)',
'nv_orders',
'
website = '.protect($website->id).' AND
coupon = '.protect($this->id)
);
if($times_used_globally > $this->times_allowed_globally)
$redeemable = false;
}
return $redeemable;
}
| CWE-89 | 0 |
public function admin_maintenance($mode = '')
{
$this->_checkReferer();
switch($mode) {
case 'backup':
set_time_limit(0);
$this->_backupDb($this->request->query['backup_encoding']);
break;
case 'restore':
set_time_limit(0);
$messages = [];
if (!$this->request->data) {
if ($this->Tool->isOverPostSize()) {
$messages[] = __d('baser', '送信できるデータ量を超えています。合計で %s 以内のデータを送信してください。', ini_get('post_max_size'));
} else {
$this->notFound();
}
}
if ($this->_restoreDb($this->request->data)) {
$messages[] = __d('baser', 'データの復元が完了しました。');
$error = false;
} else {
$messages[] = __d('baser', 'データの復元に失敗しました。ログの確認を行なって下さい。');
$error = true;
}
// Pageモデルがレストア処理でAppModelで初期化されClassRegistryにセットされている為
ClassRegistry::flush();
BcSite::flash();
if (!$error && !$this->Page->createAllPageTemplate()) {
$messages[] = __d('baser', "ページテンプレートの生成に失敗しました。\n表示できないページはページ管理より更新処理を行ってください。");
}
if ($messages) {
if ($error) {
$this->BcMessage->setError(implode("\n", $messages));
} else {
$this->BcMessage->setInfo(implode("\n", $messages));
}
}
clearAllCache();
$this->redirect(['action' => 'maintenance']);
break;
}
$this->pageTitle = __d('baser', 'データメンテナンス');
$this->help = 'tools_maintenance';
} | CWE-78 | 6 |
function move_standalone() {
expSession::clearAllUsersSessionCache('navigation');
assign_to_template(array(
'parent' => $this->params['parent'],
));
}
| CWE-89 | 0 |
private function checkDecode(array $options, array $headers, $stream)
{
// Automatically decode responses when instructed.
if (!empty($options['decode_content'])) {
$normalizedKeys = \GuzzleHttp\normalize_header_keys($headers);
if (isset($normalizedKeys['content-encoding'])) {
$encoding = $headers[$normalizedKeys['content-encoding']];
if ($encoding[0] == 'gzip' || $encoding[0] == 'deflate') {
$stream = new Psr7\InflateStream(
Psr7\stream_for($stream)
);
// Remove content-encoding header
unset($headers[$normalizedKeys['content-encoding']]);
// Fix content-length header
if (isset($normalizedKeys['content-length'])) {
$length = (int) $stream->getSize();
if ($length == 0) {
unset($headers[$normalizedKeys['content-length']]);
} else {
$headers[$normalizedKeys['content-length']] = [$length];
}
}
}
}
}
return [$stream, $headers];
} | CWE-89 | 0 |
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ; | CWE-502 | 15 |
$count += $db->dropTable($basename);
}
flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');
expHistory::back();
} | CWE-89 | 0 |
public function __construct(BufferingLogger $bootstrappingLogger = null)
{
if ($bootstrappingLogger) {
$this->bootstrappingLogger = $bootstrappingLogger;
$this->setDefaultLogger($bootstrappingLogger);
}
$this->traceReflector = new \ReflectionProperty('Exception', 'trace');
$this->traceReflector->setAccessible(true);
} | CWE-209 | 31 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id'));
$this->checkPermission($project, $filter);
if ($this->customFilterModel->remove($filter['id'])) {
$this->flash->success(t('Custom filter removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this custom filter.'));
}
$this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
foreach ($grpusers as $u) {
$emails[$u->email] = trim(user::getUserAttribution($u->id));
}
| CWE-89 | 0 |
public function beforeFilter() { // TODO REMOVE
parent::beforeFilter();
$this->Security->unlockedActions = array('saveElementSorting', 'populateEventFromTemplate', 'uploadFile', 'deleteTemporaryFile');
} | CWE-94 | 14 |
function delete_vendor() {
global $db;
if (!empty($this->params['id'])){
$db->delete('vendor', 'id =' .$this->params['id']);
}
expHistory::back();
} | CWE-89 | 0 |
public function approve() {
expHistory::set('editable', $this->params);
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
$comment = new expComment($this->params['id']);
assign_to_template(array(
'comment'=>$comment
));
} | CWE-89 | 0 |
function getTextColumns($table) {
$sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'";
$res = @mysqli_query($this->connection, $sql);
if ($res == null)
return array();
$records = array();
while($row = mysqli_fetch_object($res)) {
$records[] = $row->Field;
}
return $records;
} | CWE-89 | 0 |
function PMA_findExistingColNames($db, $cols, $allFields=false)
{
$cfgCentralColumns = PMA_centralColumnsGetParams();
if (empty($cfgCentralColumns)) {
return array();
}
$pmadb = $cfgCentralColumns['db'];
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
$central_list_table = $cfgCentralColumns['table'];
if ($allFields) {
$query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' '
. 'WHERE db_name = \'' . $db . '\' AND col_name IN (' . $cols . ');';
$has_list = (array) $GLOBALS['dbi']->fetchResult(
$query, null, null, $GLOBALS['controllink']
);
PMA_handleColumnExtra($has_list);
} else {
$query = 'SELECT col_name FROM '
. Util::backquote($central_list_table) . ' '
. 'WHERE db_name = \'' . $db . '\' AND col_name IN (' . $cols . ');';
$has_list = (array) $GLOBALS['dbi']->fetchResult(
$query, null, null, $GLOBALS['controllink']
);
}
return $has_list;
} | CWE-89 | 0 |
public function prepare( $query, $args ) {
if ( is_null( $query ) )
return;
// This is not meant to be foolproof -- but it will catch obviously incorrect usage.
if ( strpos( $query, '%' ) === false ) {
_doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9.0' );
}
$args = func_get_args();
array_shift( $args );
// If args were passed as an array (as in vsprintf), move them up
if ( isset( $args[0] ) && is_array($args[0]) )
$args = $args[0];
$query = str_replace( "'%s'", '%s', $query ); // in case someone mistakenly already singlequoted it
$query = str_replace( '"%s"', '%s', $query ); // doublequote unquoting
$query = preg_replace( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware
$query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
array_walk( $args, array( $this, 'escape_by_ref' ) );
return @vsprintf( $query, $args );
} | CWE-89 | 0 |
function manage () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
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');
}
assign_to_template(array(
'purchase_orders'=>$purchase_orders,
'vendors' => $vendors,
'vendor_id' => @$this->params['vendor']
));
} | CWE-89 | 0 |
public static function insert ($vars) {
if(is_array($vars)){
$set = "";
$k = "";
foreach ($vars['key'] as $key => $val) {
$set .= "'$val',";
$k .= "`$key`,";
}
$set = substr($set, 0,-1);
$k = substr($k, 0,-1);
$sql = sprintf("INSERT INTO `%s` (%s) VALUES (%s) ", $vars['table'], $k, $set) ;
}else{
$sql = $vars;
}
if(DB_DRIVER == 'mysql') {
mysql_query('SET CHARACTER SET utf8');
$q = mysql_query($sql) or die(mysql_error());
self::$last_id = mysql_insert_id();
}elseif(DB_DRIVER == 'mysqli'){
try {
if(!self::query($sql)){
printf("<div class=\"alert alert-danger\">Errormessage: %s</div>\n", self::$mysqli->error);
}else{
self::$last_id = self::$mysqli->insert_id;
}
} catch (exception $e) {
echo $e->getMessage();
}
}
return true;
} | CWE-79 | 1 |
public function getQueryGroupby()
{
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return "$R2.user_id";
} | CWE-89 | 0 |
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));
$ret .= scan_container($cLoc, $page->id);
$ret .= scan_page($page->id);
}
| CWE-89 | 0 |
function updateProfile($data) {
global $bigtree;
foreach ($data as $key => $val) {
if (substr($key,0,1) != "_" && !is_array($val)) {
$$key = sqlescape($val);
}
}
$id = sqlescape($this->ID);
if ($data["password"]) {
$phpass = new PasswordHash($bigtree["config"]["password_depth"], TRUE);
$password = sqlescape($phpass->HashPassword($data["password"]));
sqlquery("UPDATE bigtree_users SET `password` = '$password', `name` = '$name', `company` = '$company', `daily_digest` = '$daily_digest' WHERE id = '$id'");
} else {
sqlquery("UPDATE bigtree_users SET `name` = '$name', `company` = '$company', `daily_digest` = '$daily_digest' WHERE id = '$id'");
}
} | CWE-79 | 1 |
public static function lib($var) {
$file = GX_LIB.$var.'.class.php';
if (file_exists($file)) {
include($file);
}
}
| CWE-89 | 0 |
public function testOpen()
{
$this->mock->expects($this->once())
->method('open')
->will($this->returnValue(true));
$this->assertFalse($this->proxy->isActive());
$this->proxy->open('name', 'id');
if (PHP_VERSION_ID < 50400) {
$this->assertTrue($this->proxy->isActive());
} else {
$this->assertFalse($this->proxy->isActive());
}
} | CWE-89 | 0 |
public static function deactivate($mod){
$mods = Options::v('modules');
$mods = json_decode($mods, true);
if (!is_array($mods) || $mods == "") {
$mods = array();
}
//print_r($mods);
$arr = "";
for ($i=0;$i<count($mods);$i++) {
# code...
if ($mods[$i] == $mod) {
//unset($mods[$i]);
}else{
$arr[] = $mods[$i];
}
}
//print_r($arr);
//asort($mods);
$mods = json_encode($arr);
$mods = Options::update('modules', $mods);
if($mods){
new Options();
return true;
}else{
return false;
}
}
| CWE-89 | 0 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$category = $this->getCategory();
if ($this->categoryModel->remove($category['id'])) {
$this->flash->success(t('Category removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this category.'));
}
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
private static function sesKey() {
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
$dt = date("Y-m-d H");
$key = md5($ip.$browser.$dt);
return $key;
}
| CWE-89 | 0 |
public static function isAnimationGif($path) {
list($width, $height, $type, $attr) = getimagesize($path);
switch ($type) {
case IMAGETYPE_GIF:
break;
default:
return false;
}
$imgcnt = 0;
$fp = fopen($path, 'rb');
@fread($fp, 4);
$c = @fread($fp,1);
if (ord($c) != 0x39) { // GIF89a
return false;
}
while (!feof($fp)) {
do {
$c = fread($fp, 1);
} while(ord($c) != 0x21 && !feof($fp));
if (feof($fp)) {
break;
}
$c2 = fread($fp,2);
if (bin2hex($c2) == "f904") {
$imgcnt++;
}
if (feof($fp)) {
break;
}
}
if ($imgcnt > 1) {
return true;
} else {
return false;
}
} | CWE-89 | 0 |
protected function get_remote_contents(&$url, $timeout = 30, $redirect_max = 5, $ua = 'Mozilla/5.0', $fp = null)
{
if (preg_match('~^(?:ht|f)tps?://[-_.!\~*\'()a-z0-9;/?:\@&=+\$,%#\*\[\]]+~i', $url)) {
$info = parse_url($url);
$host = strtolower($info['host']);
// do not support IPv6 address
if (preg_match('/^\[.*\]$/', $host)) {
return false;
}
// do not support non dot URL
if (strpos($host, '.') === false) {
return false;
}
// disallow including "localhost"
if (strpos($host, 'localhost') !== false) {
return false;
}
// check IPv4 local loopback
if (preg_match('/^(?:127|0177|0x7f)\.[0-9a-fx.]+$/', $host)) {
return false;
}
// check by URL upload filter
if ($this->urlUploadFilter && is_callable($this->urlUploadFilter)) {
if (!call_user_func_array($this->urlUploadFilter, array($url, $this))) {
return false;
}
}
$method = (function_exists('curl_exec') && !ini_get('safe_mode') && !ini_get('open_basedir')) ? 'curl_get_contents' : 'fsock_get_contents';
return $this->$method($url, $timeout, $redirect_max, $ua, $fp);
}
return false;
} | CWE-918 | 16 |
}elseif(!in_array($k, $arr) && $k != 'paging'){
//self::error('404');
}else{
self::incFront('default');
}
}
}else{
| CWE-89 | 0 |
public function onLoadRecord()
{
$scheduleCode = post('recordId');
$scheduleItem = $this->getSchedule($scheduleCode);
$formTitle = sprintf(lang($this->formTitle), lang('admin::lang.text_'.$scheduleCode));
return $this->makePartial('recordeditor/form', [
'formRecordId' => $scheduleCode,
'formTitle' => $formTitle,
'formWidget' => $this->makeScheduleFormWidget($scheduleItem),
]);
} | CWE-79 | 1 |