code
stringlengths 12
2.05k
| label_name
stringlengths 6
8
| label
int64 0
95
|
---|---|---|
private static function isNonStandardPort($scheme, $host, $port)
{
if (!$scheme && $port) {
return true;
}
if (!$host || !$port) {
return false;
}
return !isset(static::$schemes[$scheme]) || $port !== static::$schemes[$scheme];
} | CWE-89 | 0 |
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 __construct() {
self::$_data = self::load();
}
| CWE-89 | 0 |
public function backup($type='json')
{
global $DB;
global $website;
$out = array();
$DB->query('
SELECT * FROM nv_comments
WHERE website = '.protect($website->id),
'object'
);
$out = $DB->result();
if($type='json')
$out = json_encode($out);
return $out;
}
| CWE-89 | 0 |
function VerifyBlockedSchedule($columns,$course_period_id,$sec,$edit=false)
{
if($course_period_id!='new')
{
$cp_det_RET= DBGet(DBQuery("SELECT * FROM course_periods WHERE course_period_id=$course_period_id"));
$cp_det_RET=$cp_det_RET[1];
$teacher=$cp_det_RET['TEACHER_ID'];
$secteacher=$cp_det_RET['SECONDARY_TEACHER_ID'];
$all_teacher=$teacher.($secteacher!=''?$secteacher:'');
} | CWE-79 | 1 |
public function remove()
{
$project = $this->getProject();
$this->checkCSRFParam();
$column_id = $this->request->getIntegerParam('column_id');
if ($this->columnModel->remove($column_id)) {
$this->flash->success(t('Column removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this column.'));
}
$this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id'])));
} | CWE-639 | 9 |
public static function getParam($param, $post_id) {
$sql = "SELECT * FROM `posts_param` WHERE `post_id` = '{$post_id}' AND `param` = '{$param}' LIMIT 1";
$q = Db::result($sql);
if (Db::$num_rows > 0) {
return $q[0]->value;
}else{
return '';
}
}
| CWE-89 | 0 |
private function checkResponse ($string) {
if (substr($string, 0, 3) !== '+OK') {
$this->error = array(
'error' => "Server reported an error: $string",
'errno' => 0,
'errstr' => ''
);
if ($this->do_debug >= 1) {
$this->displayErrors();
}
return false;
} else {
return true;
}
} | CWE-79 | 1 |
foreach ($value as $k => $val) {
if ($k != 'LAST_UPDATED') {
if ($k != 'UPDATED_BY') {
if ($k == 'ID')
$data['data'][$i]['SCHOOL_ID'] = $val;
else if ($k == 'SYEAR')
$data['data'][$i]['SCHOOL_YEAR'] = $val;
else if ($k == 'TITLE')
$data['data'][$i]['SCHOOL_NAME'] = $val;
else if ($k == 'WWW_ADDRESS')
$data['data'][$i]['URL'] = $val;
else
$data['data'][$i][$k] = $val;
}
}
} | CWE-79 | 1 |
protected function getFoo2Service()
{
return $this->services['Foo\Foo'] = new \Foo\Foo();
} | CWE-89 | 0 |
public function showUnpublished() {
expHistory::set('viewable', $this->params);
// setup the where clause for looking up records.
$where = parent::aggregateWhereClause();
$where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where;
if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1';
$page = new expPaginator(array(
'model'=>'news',
'where'=>$where,
'limit'=>25,
'order'=>'unpublish',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title',
gt('Published On')=>'publish',
gt('Status')=>'unpublish'
),
));
assign_to_template(array(
'page'=>$page
));
} | CWE-89 | 0 |
function nvweb_dictionary_load()
{
global $DB;
global $session;
global $website;
global $theme;
$dictionary = array();
// the dictionary is an array merged from the following sources (- to + preference)
// theme dictionary (json)
// theme dictionary on database
// webdictionary custom entries
// theme dictionary
if(!empty($theme))
{
$theme->dictionary = array(); // clear previous loaded dictionary
$theme->t(); // force theme dictionary load
}
if(!empty($theme->dictionary))
$dictionary = $theme->dictionary;
// webdictionary custom entries
$DB->query('SELECT node_id, text
FROM nv_webdictionary
WHERE node_type = "global"
AND lang = '.protect($session['lang']).'
AND website = '.$website->id.'
UNION
SELECT subtype AS node_id, text
FROM nv_webdictionary
WHERE node_type = "theme"
AND theme = '.protect($website->theme).'
AND lang = '.protect($session['lang']).'
AND website = '.$website->id
);
$data = $DB->result();
if(!is_array($data)) $data = array();
foreach($data as $item)
{
$dictionary[$item->node_id] = $item->text;
}
return $dictionary;
}
| CWE-89 | 0 |
public function save()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) {
if ($this->categoryModel->create($values) !== false) {
$this->flash->success(t('Your category have been created successfully.'));
$this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);
return;
} else {
$errors = array('name' => array(t('Another category with the same name exists in this project')));
}
}
$this->create($values, $errors);
} | CWE-639 | 9 |
public function load_from_post()
{
$this->codename = $_REQUEST['codename'];
$this->icon = $_REQUEST['icon'];
$this->lid = $_REQUEST['lid'];
$this->notes = $_REQUEST['notes'];
$this->enabled = ($_REQUEST['enabled']=='1'? '1' : '0');
// load associated functions
$functions = explode('#', $_REQUEST['menu-functions']);
$this->functions = array();
foreach($functions as $function)
{
if(!empty($function))
$this->functions[] = $function;
}
}
| CWE-79 | 1 |
static function decrypt($string, $key) {
$result = '';
$string = base64_decode($string);
for ($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)-ord($keychar));
$result .= $char;
}
return Toolbox::unclean_cross_side_scripting_deep($result);
} | CWE-798 | 18 |
$count += $db->dropTable($basename);
}
flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');
expHistory::back();
} | CWE-89 | 0 |
public function rules()
{
$rules = [
// 'title' => 'required', // todo with multilanguage
];
return $rules;
} | CWE-190 | 19 |
public function IsSendmail() {
if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
$this->Sendmail = '/var/qmail/bin/sendmail';
}
$this->Mailer = 'sendmail';
} | CWE-79 | 1 |
function edit_option_master() {
expHistory::set('editable', $this->params);
$params = isset($this->params['id']) ? $this->params['id'] : $this->params;
$record = new option_master($params);
assign_to_template(array(
'record'=>$record
));
} | CWE-89 | 0 |
function categoryBreadcrumb() {
// global $db, $router;
//eDebug($this->category);
/*if(isset($router->params['action']))
{
$ancestors = $this->category->pathToNode();
}else if(isset($router->params['section']))
{
$current = $db->selectObject('section',' id= '.$router->params['section']);
$ancestors[] = $current;
if( $current->parent != -1 || $current->parent != 0 )
{
while ($db->selectObject('section',' id= '.$router->params['section']);)
if ($section->id == $id) {
$current = $section;
break;
}
}
}
eDebug($sections);
$ancestors = $this->category->pathToNode();
}*/
$ancestors = $this->category->pathToNode();
// eDebug($ancestors);
assign_to_template(array(
'ancestors' => $ancestors
));
} | CWE-89 | 0 |
function VerifyFixedSchedule($columns,$columns_var,$update=false)
{
$qr_teachers= DBGet(DBQuery('select TEACHER_ID,SECONDARY_TEACHER_ID from course_periods where course_period_id=\''.$_REQUEST['course_period_id'].'\''));
$teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']:$qr_teachers[1]['TEACHER_ID']);
$secteacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']:$qr_teachers[1]['SECONDARY_TEACHER_ID']);
// $secteacher=$qr_teachers[1]['SECONDARY_TEACHER_ID'];
if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='')
$all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); | CWE-79 | 1 |
public function Mail($from) {
$this->error = null; // so no confusion is caused
if(!$this->connected()) {
$this->error = array(
"error" => "Called Mail() without being connected");
return false;
}
$useVerp = ($this->do_verp ? " XVERP" : "");
fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
$rply = $this->get_lines();
$code = substr($rply,0,3);
if($this->do_debug >= 2) {
$this->edebug("SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />');
}
if($code != 250) {
$this->error =
array("error" => "MAIL not accepted from server",
"smtp_code" => $code,
"smtp_msg" => substr($rply,4));
if($this->do_debug >= 1) {
$this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />');
}
return false;
}
return true;
} | CWE-79 | 1 |
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 |
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql);
foreach ($evs as $key=>$event) {
if ($condense) {
$eventid = $event->id;
$multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;'));
if (!empty($multiday_event)) {
unset($evs[$key]);
continue;
}
}
$evs[$key]->eventstart += $edate->date;
$evs[$key]->eventend += $edate->date;
$evs[$key]->date_id = $edate->id;
if (!empty($event->expCat)) {
$catcolor = empty($event->expCat[0]->color) ? null : trim($event->expCat[0]->color);
// if (substr($catcolor,0,1)=='#') $catcolor = '" style="color:'.$catcolor.';';
$evs[$key]->color = $catcolor;
}
}
if (count($events) < 500) { // magic number to not crash loop?
$events = array_merge($events, $evs);
} else {
// $evs[$key]->title = gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!');
// $events = array_merge($events, $evs);
flash('notice',gt('Too many events to list').', '.(count($edates)-count($events)).' '.gt('not displayed!'));
break; // keep from breaking system by too much data
}
}
| CWE-89 | 0 |
public static function hasChildren($i) {
global $sections;
if (($i + 1) >= count($sections)) return false;
return ($sections[$i]->depth < $sections[$i + 1]->depth) ? true : false;
}
| CWE-89 | 0 |
public function showall() {
global $user, $sectionObj, $sections;
expHistory::set('viewable', $this->params);
$id = $sectionObj->id;
$current = null;
// all we need to do is determine the current section
$navsections = $sections;
if ($sectionObj->parent == -1) {
$current = $sectionObj;
} else {
foreach ($navsections as $section) {
if ($section->id == $id) {
$current = $section;
break;
}
}
}
assign_to_template(array(
'sections' => $navsections,
'current' => $current,
'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0),
));
}
| CWE-89 | 0 |
function edit_vendor() {
$vendor = new vendor();
if(isset($this->params['id'])) {
$vendor = $vendor->find('first', 'id =' .$this->params['id']);
assign_to_template(array(
'vendor'=>$vendor
));
}
} | CWE-89 | 0 |
public function showall_tags() {
$images = $this->image->find('all');
$used_tags = array();
foreach ($images as $image) {
foreach($image->expTag as $tag) {
if (isset($used_tags[$tag->id])) {
$used_tags[$tag->id]->count++;
} else {
$exptag = new expTag($tag->id);
$used_tags[$tag->id] = $exptag;
$used_tags[$tag->id]->count = 1;
}
}
}
assign_to_template(array(
'tags'=>$used_tags
));
} | CWE-89 | 0 |
public function setUp()
{
$client = $this->getHttpClient();
$request = $this->getHttpRequest();
$this->request = new RestCreateSubscriptionRequest($client, $request);
$this->request->initialize(array(
'name' => 'Test Subscription',
'description' => 'Test Billing Subscription',
'startDate' => new \DateTime(),
'planId' => 'ABC-123',
'payerDetails' => array(
'payment_method' => 'paypal',
),
));
} | CWE-89 | 0 |
public function rules()
{
return [
'name' => 'required',
'email' => 'required|email',
'address' => '',
'primary_number' => 'numeric',
'secondary_number' => 'numeric',
'password' => 'required|min:5|confirmed',
'password_confirmation' => 'required|min:5',
'image_path' => '',
'roles' => 'required',
'departments' => 'required'
];
} | CWE-521 | 4 |
public static function url() {
return Site::$url.'/inc/lib/Vendor';
}
| CWE-89 | 0 |
public static function delete($id){
$id = sprintf('%d', $id);
$parent = self::getParent($id);
$sql = array(
'table' => 'cat',
'where' => array(
'id' => $id
)
);
$cat = Db::delete($sql);
if($cat){
return true;
}else{
return false;
}
// check all posts with this category and move to parent categories
$post = Db::result("SELECT `id` FROM `posts`
WHERE `cat` = '{$id}'");
$npost = Db::$num_rows;
//print_r($parent);
if($npost > 0){
$sql = "UPDATE `posts`
SET `cat` = '{$parent[0]->parent}'
WHERE `cat` = '{$id}'";
Db::query($sql);
}
}
| CWE-89 | 0 |
public function manage_versions() {
expHistory::set('manageable', $this->params);
$hv = new help_version();
$current_version = $hv->find('first', 'is_current=1');
$sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h ';
$sql .= 'RIGHT JOIN '.DB_TABLE_PREFIX.'_help_version hv ON h.help_version_id=hv.id GROUP BY hv.version';
$page = new expPaginator(array(
'sql'=>$sql,
'limit'=>30,
'order' => (isset($this->params['order']) ? $this->params['order'] : 'version'),
'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'),
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Version')=>'version',
gt('Title')=>'title',
gt('Current')=>'is_current',
gt('# of Docs')=>'num_docs'
),
));
assign_to_template(array(
'current_version'=>$current_version,
'page'=>$page
));
} | CWE-89 | 0 |
public function __construct() {
}
| CWE-89 | 0 |
public function start()
{
if ($this->started) {
return true;
}
if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE === session_status()) {
throw new \RuntimeException('Failed to start the session: already started by PHP.');
}
if (PHP_VERSION_ID < 50400 && !$this->closed && isset($_SESSION) && session_id()) {
// not 100% fool-proof, but is the most reliable way to determine if a session is active in PHP 5.3
throw new \RuntimeException('Failed to start the session: already started by PHP ($_SESSION is set).');
}
if (ini_get('session.use_cookies') && headers_sent($file, $line)) {
throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
}
// ok to try and start the session
if (!session_start()) {
throw new \RuntimeException('Failed to start the session');
}
$this->loadSession();
if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) {
// This condition matches only PHP 5.3 with internal save handlers
$this->saveHandler->setActive(true);
}
return true;
} | CWE-89 | 0 |
public static function page($vars) {
switch (SMART_URL) {
case true:
# code...
$url = Options::get('siteurl')."/".self::slug($vars).GX_URL_PREFIX;
break;
default:
# code...
$url = Options::get('siteurl')."/index.php?page={$vars}";
break;
}
return $url;
} | CWE-89 | 0 |
public static function delete($id){
$sql = array(
'table' => 'menus',
'where' => array(
'id' => $id
)
);
$menu = Db::delete($sql);
}
| 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 |
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;
}
}
| CWE-89 | 0 |
public function configure() {
$this->config['defaultbanner'] = array();
if (!empty($this->config['defaultbanner_id'])) {
$this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']);
}
parent::configure();
$banners = $this->banner->find('all', null, 'companies_id');
assign_to_template(array(
'banners'=>$banners,
'title'=>static::displayname()
));
} | 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 getCategory()
{
$category = $this->categoryModel->getById($this->request->getIntegerParam('category_id'));
if (empty($category)) {
throw new PageNotFoundException();
}
return $category;
} | CWE-639 | 9 |
public function validate() {
global $db;
// check for an sef url field. If it exists make sure it's valid and not a duplicate
//this needs to check for SEF URLS being turned on also: TODO
if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) {
if (empty($this->sef_url)) $this->makeSefUrl();
if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();
if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();
}
// safeguard again loc data not being pass via forms...sometimes this happens when you're in a router
// mapped view and src hasn't been passed in via link to the form
if (isset($this->id) && empty($this->location_data)) {
$loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);
if (!empty($loc)) $this->location_data = $loc;
}
// run the validation as defined in the models
if (!isset($this->validates)) return true;
$messages = array();
$post = empty($_POST) ? array() : expString::sanitize($_POST);
foreach ($this->validates as $validation=> $field) {
foreach ($field as $key=> $value) {
$fieldname = is_numeric($key) ? $value : $key;
$opts = is_numeric($key) ? array() : $value;
$ret = expValidator::$validation($fieldname, $this, $opts);
if (!is_bool($ret)) {
$messages[] = $ret;
expValidator::setErrorField($fieldname);
unset($post[$fieldname]);
}
}
}
if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);
} | CWE-89 | 0 |
public function subscriptions() {
global $db;
expHistory::set('manageable', $this->params);
// 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
$sub = new subscribers($this->params['id']);
if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.'));
// get this users subscriptions
$subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id);
// get a list of all available E-Alerts
$ealerts = new expeAlerts();
assign_to_template(array(
'subscriber'=>$sub,
'subscriptions'=>$subscriptions,
'ealerts'=>$ealerts->find('all')
));
} | CWE-89 | 0 |
function updateObject($object, $table, $where=null, $identifier='id', $is_revisioned=false) {
if ($is_revisioned) {
$object->revision_id++;
//if ($table=="text") eDebug($object);
$res = $this->insertObject($object, $table);
//if ($table=="text") eDebug($object,true);
$this->trim_revisions($table, $object->$identifier, WORKFLOW_REVISION_LIMIT);
return $res;
}
$sql = "UPDATE " . $this->prefix . "$table SET ";
foreach (get_object_vars($object) as $var => $val) {
//We do not want to save any fields that start with an '_'
//if($is_revisioned && $var=='revision_id') $val++;
if ($var{0} != '_') {
if (is_array($val) || is_object($val)) {
$val = serialize($val);
$sql .= "`$var`='".$val."',";
} else {
$sql .= "`$var`='" . $this->escapeString($val) . "',";
}
}
}
$sql = substr($sql, 0, -1) . " WHERE ";
if ($where != null)
$sql .= $this->injectProof($where);
else
$sql .= "`" . $identifier . "`=" . $object->$identifier;
//if ($table == 'text') eDebug($sql,true);
$res = (@mysqli_query($this->connection, $sql) != false);
return $res;
} | CWE-89 | 0 |
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 |
$sloc = expCore::makeLocation('navigation', null, $section->id);
// remove any manage permissions for this page and it's children
// $db->delete('userpermission', "module='navigationController' AND internal=".$section->id);
// $db->delete('grouppermission', "module='navigationController' AND internal=".$section->id);
foreach ($allusers as $uid) {
$u = user::getUserById($uid);
expPermissions::grant($u, 'manage', $sloc);
}
foreach ($allgroups as $gid) {
$g = group::getGroupById($gid);
expPermissions::grantGroup($g, 'manage', $sloc);
}
}
}
| CWE-89 | 0 |
public function display_sdm_thumbnail_meta_box($post) { // Thumbnail upload metabox
$old_thumbnail = get_post_meta($post->ID, 'sdm_upload_thumbnail', true);
$old_value = isset($old_thumbnail) ? $old_thumbnail : '';
_e('Manually enter a valid URL, or click "Select Image" to upload (or choose) the file thumbnail image.', 'simple-download-monitor');
?>
<br /><br />
<input id="sdm_upload_thumbnail" type="text" size="100" name="sdm_upload_thumbnail" value="<?php echo $old_value; ?>" placeholder="http://..." />
<br /><br />
<input id="upload_thumbnail_button" type="button" class="button-primary" value="<?php _e('Select Image', 'simple-download-monitor'); ?>" />
<input id="remove_thumbnail_button" type="button" class="button" value="<?php _e('Remove Image', 'simple-download-monitor'); ?>" />
<br /><br />
<span id="sdm_admin_thumb_preview">
<?php
if (!empty($old_value)) {
?><img id="sdm_thumbnail_image" src="<?php echo $old_value; ?>" style="max-width:200px;" />
<?php
}
?>
</span>
<?php
echo '<p class="description">';
_e('This thumbnail image will be used to create a fancy file download box if you want to use it.', 'simple-download-monitor');
echo '</p>';
wp_nonce_field('sdm_thumbnail_box_nonce', 'sdm_thumbnail_box_nonce_check');
} | CWE-79 | 1 |
public function update_discount() {
$id = empty($this->params['id']) ? null : $this->params['id'];
$discount = new discounts($id);
// find required shipping method if needed
if ($this->params['required_shipping_calculator_id'] > 0) {
$this->params['required_shipping_method'] = $this->params['required_shipping_methods'][$this->params['required_shipping_calculator_id']];
} else {
$this->params['required_shipping_calculator_id'] = 0;
}
$discount->update($this->params);
expHistory::back();
} | CWE-89 | 0 |
public function skip($value)
{
return $this->offset($value);
} | CWE-22 | 2 |
public function open($savePath, $sessionName)
{
$return = (bool) $this->handler->open($savePath, $sessionName);
if (true === $return) {
$this->active = true;
}
return $return;
} | CWE-89 | 0 |
function show_vendor () {
$vendor = new vendor();
if(isset($this->params['id'])) {
$vendor = $vendor->find('first', 'id =' .$this->params['id']);
$vendor_title = $vendor->title;
$state = new geoRegion($vendor->state);
$vendor->state = $state->name;
//Removed unnecessary fields
unset(
$vendor->title,
$vendor->table,
$vendor->tablename,
$vendor->classname,
$vendor->identifier
);
assign_to_template(array(
'vendor_title' => $vendor_title,
'vendor'=>$vendor
));
}
} | CWE-89 | 0 |
public function enable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->enable($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 static function doTablesUpdate($definition){
$updateInformation = self::getTablesStatus($definition);
$db = ezcDbInstance::get();
$errorMessages = array();
try {
$db->query('SET GLOBAL innodb_strict_mode = 0;');
$db->query('SET GLOBAL innodb_file_per_table=1;');
$db->query('SET GLOBAL innodb_large_prefix=1;');
} catch (Exception $e) {
//$errorMessages[] = $e->getMessage();
}
foreach ($updateInformation as $table => $tableData) {
if ($tableData['error'] == true) {
foreach ($tableData['queries'] as $query) {
try {
$db->query($query);
} catch (Exception $e) {
$errorMessages[] = $e->getMessage();
}
}
}
}
return $errorMessages;
}
| CWE-79 | 1 |
function manage_upcharge() {
$this->loc->src = "@globalstoresettings";
$config = new expConfig($this->loc);
$this->config = $config->config;
$gc = new geoCountry();
$countries = $gc->find('all');
$gr = new geoRegion();
$regions = $gr->find('all',null,'rank asc,name asc');
assign_to_template(array(
'countries'=>$countries,
'regions'=>$regions,
'upcharge'=>!empty($this->config['upcharge'])?$this->config['upcharge']:''
));
} | CWE-89 | 0 |
protected function getSubtask()
{
$subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id'));
if (empty($subtask)) {
throw new PageNotFoundException();
}
return $subtask;
} | CWE-639 | 9 |
public static function isPublic($s) {
if ($s == null) {
return false;
}
while ($s->public && $s->parent > 0) {
$s = new section($s->parent);
}
$lineage = (($s->public) ? 1 : 0);
return $lineage;
}
| CWE-89 | 0 |
recyclebin::sendToRecycleBin($loc, $parent);
//FIXME if we delete the module & sectionref the module completely disappears
// if (class_exists($secref->module)) {
// $modclass = $secref->module;
// //FIXME: more module/controller glue code
// if (expModules::controllerExists($modclass)) {
// $modclass = expModules::getControllerClassName($modclass);
// $mod = new $modclass($loc->src);
// $mod->delete_instance();
// } else {
// $mod = new $modclass();
// $mod->deleteIn($loc);
// }
// }
}
// $db->delete('sectionref', 'section=' . $parent);
$db->delete('section', 'parent=' . $parent);
}
| CWE-89 | 0 |
public function 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 |
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 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 |
$date->delete(); // event automatically deleted if all assoc eventdates are deleted
}
expHistory::back();
}
| CWE-89 | 0 |
public function updateForgottenPassword(array $input) {
$condition = [
'glpi_users.is_active' => 1,
'glpi_users.is_deleted' => 0, [
'OR' => [
['glpi_users.begin_date' => null],
['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]
],
], [
'OR' => [
['glpi_users.end_date' => null],
['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]
]
]
];
if ($this->getFromDBbyEmail($input['email'], $condition)) {
if (($this->fields["authtype"] == Auth::DB_GLPI)
|| !Auth::useAuthExt()) {
if (($input['password_forget_token'] == $this->fields['password_forget_token'])
&& (abs(strtotime($_SESSION["glpi_currenttime"])
-strtotime($this->fields['password_forget_token_date'])) < DAY_TIMESTAMP)) {
$input['id'] = $this->fields['id'];
Config::validatePassword($input["password"], false); // Throws exception if password is invalid
if (!$this->update($input)) {
return false;
}
$input2 = [
'password_forget_token' => '',
'password_forget_token_date' => null,
'id' => $this->fields['id']
];
$this->update($input2);
return true;
} else {
throw new ForgetPasswordException(__('Your password reset request has expired or is invalid. Please renew it.'));
}
} else {
throw new ForgetPasswordException(__("The authentication method configuration doesn't allow you to change your password."));
}
} else {
throw new ForgetPasswordException(__('Email address not found.'));
}
return false;
} | CWE-640 | 20 |
function edit_freeform() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
if (empty($section->id)) {
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
}
| CWE-89 | 0 |
function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) {
if (empty($endtimestamp)) {
$date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($timestamp) . ")";
} else {
$date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($endtimestamp) . ")";
}
if ($multiday)
$date_sql .= " OR (" . expDateTime::startOfDayTimestamp($timestamp) . " BETWEEN ".$field." AND dateFinished)";
$date_sql .= ")";
return $date_sql;
}
| CWE-89 | 0 |
public function display_sdm_other_details_meta_box($post) { //Other details metabox
$file_size = get_post_meta($post->ID, 'sdm_item_file_size', true);
$file_size = isset($file_size) ? $file_size : '';
$version = get_post_meta($post->ID, 'sdm_item_version', true);
$version = isset($version) ? $version : '';
echo '<div class="sdm-download-edit-filesize">';
_e('File Size: ', 'simple-download-monitor');
echo '<br />';
echo ' <input type="text" name="sdm_item_file_size" value="' . $file_size . '" size="20" />';
echo '<p class="description">' . __('Enter the size of this file (example value: 2.15 MB). You can show this value in the fancy display by using a shortcode parameter.', 'simple-download-monitor') . '</p>';
echo '</div>';
echo '<div class="sdm-download-edit-version">';
_e('Version: ', 'simple-download-monitor');
echo '<br />';
echo ' <input type="text" name="sdm_item_version" value="' . $version . '" size="20" />';
echo '<p class="description">' . __('Enter the version number for this item if any (example value: v2.5.10). You can show this value in the fancy display by using a shortcode parameter.', 'simple-download-monitor') . '</p>';
echo '</div>';
wp_nonce_field('sdm_other_details_nonce', 'sdm_other_details_nonce_check');
} | CWE-79 | 1 |
public function getQuerySelect()
{
return "c.submitted_by AS `" . $this->name . "`";
} | 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 testNewInstanceWhenNewProtocol()
{
$r = new Response(200);
$this->assertNotSame($r, $r->withProtocolVersion('1.0'));
} | CWE-89 | 0 |
protected function _rmdir($path) {
$ret = @rmdir($path);
$ret && clearstatcache();
return $ret;
} | 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 |
function delete() {
global $db;
if (empty($this->params['id'])) return false;
$product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']);
$product = new $product_type($this->params['id'], true, false);
//eDebug($product_type);
//eDebug($product, true);
//if (!empty($product->product_type_id)) {
//$db->delete($product_type, 'id='.$product->product_id);
//}
$db->delete('option', 'product_id=' . $product->id . " AND optiongroup_id IN (SELECT id from " . $db->prefix . "optiongroup WHERE product_id=" . $product->id . ")");
$db->delete('optiongroup', 'product_id=' . $product->id);
//die();
$db->delete('product_storeCategories', 'product_id=' . $product->id . ' AND product_type="' . $product_type . '"');
if ($product->product_type == "product") {
if ($product->hasChildren()) {
$this->deleteChildren();
}
}
$product->delete();
flash('message', gt('Product deleted successfully.'));
expHistory::back();
} | CWE-89 | 0 |
public function testNewInstanceWhenNewBody()
{
$r = new Response(200, [], 'foo');
$b2 = Psr7\stream_for('abc');
$this->assertNotSame($r, $r->withBody($b2));
} | CWE-89 | 0 |
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 parseAndTrimImport($str, $isHTML = false) { //�Death from above�? �
//echo "1<br>"; eDebug($str);
// global $db;
$str = str_replace("�", "’", $str);
$str = str_replace("�", "‘", $str);
$str = str_replace("�", "®", $str);
$str = str_replace("�", "-", $str);
$str = str_replace("�", "—", $str);
$str = str_replace("�", "”", $str);
$str = str_replace("�", "“", $str);
$str = str_replace("\r\n", " ", $str);
$str = str_replace("\,", ",", $str);
$str = str_replace('""', '"', $str); //do this no matter what...in case someone added a quote in a non HTML field
if (!$isHTML) {
//if HTML, then leave the single quotes alone, otheriwse replace w/ special Char
$str = str_replace('"', """, $str);
}
$str = str_replace("�", "¼", $str);
$str = str_replace("�", "½", $str);
$str = str_replace("�", "¾", $str);
//$str = htmlspecialchars($str);
//$str = utf8_encode($str);
// if (DB_ENGINE=='mysqli') {
// $str = @mysqli_real_escape_string($db->connection,trim(str_replace("�", "™", $str)));
// } elseif(DB_ENGINE=='mysql') {
// $str = @mysql_real_escape_string(trim(str_replace("�", "™", $str)),$db->connection);
// } else {
// $str = trim(str_replace("�", "™", $str));
// }
$str = @expString::escape(trim(str_replace("�", "™", $str)));
//echo "2<br>"; eDebug($str,die);
return $str;
} | CWE-89 | 0 |
public function display_sdm_upload_meta_box($post) { // File Upload metabox
$old_upload = get_post_meta($post->ID, 'sdm_upload', true);
$old_value = isset($old_upload) ? $old_upload : '';
_e('Manually enter a valid URL of the file in the text box below, or click "Select File" button to upload (or choose) the downloadable file.', 'simple-download-monitor');
echo '<br /><br />';
echo '<div class="sdm-download-edit-file-url-section">';
echo '<input id="sdm_upload" type="text" size="100" name="sdm_upload" value="' . $old_value . '" placeholder="http://..." />';
echo '</div>';
echo '<br />';
echo '<input id="upload_image_button" type="button" class="button-primary" value="' . __('Select File', 'simple-download-monitor') . '" />';
echo '<br /><br />';
_e('Steps to upload a file or choose one from your media library:', 'simple-download-monitor');
echo '<ol>';
echo '<li>Hit the "Select File" button.</li>';
echo '<li>Upload a new file or choose an existing one from your media library.</li>';
echo '<li>Click the "Insert" button, this will populate the uploaded file\'s URL in the above text field.</li>';
echo '</ol>';
wp_nonce_field('sdm_upload_box_nonce', 'sdm_upload_box_nonce_check');
} | CWE-79 | 1 |
function __construct()
{
$this->render_menu_page();
}
| CWE-79 | 1 |
public function routePostProvider()
{
return [
['/api/articles/', 1, 'articles', 'post', false],
['/api/v1/articles/', 1, 'articles', 'post', false],
['/api/v2/articles/', 2, 'articles', 'post', false],
['/api/articles/5', 1, 'articles', 'post', 5],
['/api/v1/articles/5', 1, 'articles', 'post', 5],
['/api/v2/articles/5', 2, 'articles', 'post', 5],
];
} | CWE-601 | 11 |
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 |
public static function pathFile($path, $file=false)
{
if($file!==false){
$fullPath = $path.$file;
}
else {
$fullPath = $path;
}
// Fix for Windows on paths. eg: $path = c:\diego/page/subpage convert to c:\diego\page\subpages
$fullPath = str_replace('/', DS, $fullPath);
if(CHECK_SYMBOLIC_LINKS) {
$real = realpath($fullPath);
}
else {
$real = file_exists($fullPath)?$fullPath:false;
}
// If $real is FALSE the file does not exist.
if($real===false) {
return false;
}
// If the $real path does not start with the systemPath then this is Path Traversal.
if(strpos($fullPath, $real)!==0) {
return false;
}
return true;
} | CWE-434 | 5 |
$eml->prepareBody();
}
list ($success, $message) = $this->checkDoNotEmailFields ($eml);
if (!$success) {
return array ($success, $message);
}
$result = $eml->send($historyFlag);
if (isset($result['code']) && $result['code'] == 200) {
if (YII_UNIT_TESTING) {
return array(true, $eml->message);
} else {
return array(true, "");
}
} else {
return array (false, Yii::t('app', "Email could not be sent"));
}
} | CWE-79 | 1 |
public static function Zipped () {
global $HTTP_ACCEPT_ENCODING;
if( headers_sent() ){
$encoding = false;
}elseif( strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false ){
$encoding = 'x-gzip';
}elseif( strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false ){
$encoding = 'gzip';
}else{
$encoding = false;
}
if( $encoding ){
$contents = ob_get_contents();
ob_end_clean();
header('Content-Encoding: '.$encoding);
print("\x1f\x8b\x08\x00\x00\x00\x00\x00");
$size = strlen($contents);
$contents = gzcompress($contents, 9);
$contents = substr($contents, 0, $size);
print($contents);
exit();
}else{
ob_end_flush();
exit();
}
}
| CWE-89 | 0 |
private function doTestEncodeFormulas(bool $legacy = false)
{
if ($legacy) {
$this->encoder = new CsvEncoder(',', '"', '\\', '.', true);
} else {
$this->encoder = new CsvEncoder([CsvEncoder::ESCAPE_FORMULAS_KEY => true]);
}
$this->assertSame(<<<'CSV'
0
" =2+3"
CSV
, $this->encoder->encode(['=2+3'], 'csv'));
$this->assertSame(<<<'CSV'
0
" -2+3"
CSV
, $this->encoder->encode(['-2+3'], 'csv'));
$this->assertSame(<<<'CSV'
0
" +2+3"
CSV
, $this->encoder->encode(['+2+3'], 'csv'));
$this->assertSame(<<<'CSV'
0
" @MyDataColumn"
CSV
, $this->encoder->encode(['@MyDataColumn'], 'csv'));
} | CWE-1236 | 12 |
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'");
}
if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);
// eDebug($sql, true);
// count the unapproved comments
if ($require_approval == 1 && $user->isAdmin()) {
$sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com ';
$sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id ';
$sql .= 'WHERE cnt.content_id='.$this->params['content_id']." AND cnt.content_type='".$this->params['content_type']."' ";
$sql .= 'AND com.approved=0';
$unapproved = $db->countObjectsBySql($sql);
} else {
$unapproved = 0;
}
$this->config = $this->params['config'];
$type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment');
$ratings = !empty($this->params['ratings']) ? true : false;
assign_to_template(array(
'comments'=>$comments,
'config'=>$this->params['config'],
'unapproved'=>$unapproved,
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'user'=>$user,
'hideform'=>$this->params['hideform'],
'hidecomments'=>$this->params['hidecomments'],
'title'=>$this->params['title'],
'formtitle'=>$this->params['formtitle'],
'type'=>$type,
'ratings'=>$ratings,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
));
} | CWE-89 | 0 |
public function get_view_config() {
global $template;
// set paths we will search in for the view
$paths = array(
BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure',
BASE.'framework/modules/common/views/file/configure',
);
foreach ($paths as $path) {
$view = $path.'/'.$this->params['view'].'.tpl';
if (is_readable($view)) {
if (bs(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
if (bs3(true)) {
$bstrapview = $path.'/'.$this->params['view'].'.bootstrap3.tpl';
if (file_exists($bstrapview)) {
$view = $bstrapview;
}
}
$template = new controllertemplate($this, $view);
$ar = new expAjaxReply(200, 'ok');
$ar->send();
}
}
} | CWE-89 | 0 |
function singleQuoteReplace($param1 = false, $param2 = false, $param3)
{
return str_replace("'", "''", str_replace("\'", "'", $param3));
} | CWE-79 | 1 |
public static function format ($post, $id) {
// split post for readmore...
$post = Typo::Xclean($post);
$more = explode('[[--readmore--]]', $post);
//print_r($more);
if (count($more) > 1) {
$post = explode('[[--readmore--]]', $post);
$post = $post[0]." <a href=\"".Url::post($id)."\">".READ_MORE."</a>";
}else{
$post = $post;
}
$post = Hooks::filter('post_content_filter', $post);
return $post;
}
| 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 |
public function testCanCreateNewResponseWithStatusAndNoReason()
{
$r = new Response(200);
$r2 = $r->withStatus(201);
$this->assertEquals(200, $r->getStatusCode());
$this->assertEquals('OK', $r->getReasonPhrase());
$this->assertEquals(201, $r2->getStatusCode());
$this->assertEquals('Created', $r2->getReasonPhrase());
} | CWE-89 | 0 |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| 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 .= "'" . mysqli_real_escape_string($this->connection, $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 |
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-79 | 1 |
$section = new section($this->params);
} else {
notfoundController::handle_not_found();
exit;
}
if (!empty($section->id)) {
$check_id = $section->id;
} else {
$check_id = $section->parent;
}
if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) {
if (empty($section->id)) {
$section->active = 1;
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
} else { // User does not have permission to manage sections. Throw a 403
notfoundController::handle_not_authorized();
}
}
| CWE-89 | 0 |
$logo = "<img src=\"".self::$url.Options::v('logo')."\"
style=\"width: $width; height: $height; margin: 1px;\">";
}else{
$logo = "<span class=\"mg genixcms-logo\"></span>";
}
return $logo;
}
| CWE-89 | 0 |
public function saveconfig() {
global $db;
if (empty($this->params['id'])) return false;
$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);
$calc = new $calcname($this->params['id']);
$conf = serialize($calc->parseConfig($this->params));
$calc->update(array('config'=>$conf));
expHistory::back();
} | CWE-89 | 0 |
public static function TimeZone(){
$timezones = DateTimeZone::listAbbreviations(DateTimeZone::ALL);
$cities = array();
foreach( $timezones as $key => $zones )
{
foreach( $zones as $id => $zone )
{
//print_r($zone);
/**
* Only get timezones explicitely not part of "Others".
* @see http://www.php.net/manual/en/timezones.others.php
*/
if ( preg_match( '/^(America|Antartica|Arctic|Asia|Atlantic|Europe|Indian|Pacific)\//', $zone['timezone_id'] )
&& $zone['timezone_id']) {
$cities[$zone['timezone_id']][] = $key;
}
}
}
// For each city, have a comma separated list of all possible timezones for that city.
foreach( $cities as $key => $value )
$cities[$key] = join( ', ', $value);
// Only keep one city (the first and also most important) for each set of possibilities.
$cities = array_unique( $cities );
// Sort by area/city name.
ksort( $cities );
return $cities;
}
| CWE-89 | 0 |
$user = db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($check['user']), 'username');
form_alternate_row('line' . $check['id']);
$name = get_data_source_title($check['datasource']);
$title = $name;
if (strlen($name) > 50) {
$name = substr($name, 0, 50);
}
form_selectable_cell('<a class="linkEditMain" title="' . $title .'" href="' . htmlspecialchars('data_debug.php?action=view&id=' . $check['id']) . '">' . $name . '</a>', $check['id']);
form_selectable_cell($user, $check['id']);
form_selectable_cell(date('F j, Y, G:i', $check['started']), $check['id']);
form_selectable_cell($check['datasource'], $check['id']);
form_selectable_cell(debug_icon(($check['done'] ? (strlen($issue_line) ? 'off' : 'on' ) : '')), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['rrd_writable']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['rrd_exists']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['active']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['rrd_match']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon($info['valid_data']), $check['id'], '', 'text-align: center;');
form_selectable_cell(debug_icon(($info['rra_timestamp2'] != '' ? 1 : '')), $check['id'], '', 'text-align: center;');
form_selectable_cell('<a class=\'linkEditMain\' href=\'#\' title="' . html_escape($issue_title) . '">' . html_escape(strlen(trim($issue_line)) ? $issue_line : '<none>') . '</a>', $check['id']);
form_checkbox_cell($check['id'], $check['id']);
form_end_row();
}
}else{ | CWE-79 | 1 |
public function add($array)
{
$this->db = array_merge($array, $this->db);
} | CWE-434 | 5 |
function html_split_string($string, $length = 70, $forgiveness = 10) {
$new_string = '';
$j = 0;
$done = false;
while (!$done) {
if (strlen($string) > $length) {
for($i = 0; $i < $forgiveness; $i++) {
if (substr($string, $length-$i, 1) == " ") {
$new_string .= substr($string, 0, $length-$i) . "<br>";
break;
}
}
$string = substr($string, $length-$i);
} else {
$new_string .= $string;
$done = true;
}
$j++;
if ($j > 4) break;
}
return $new_string;
} | CWE-79 | 1 |
$contents = ['form' => tep_draw_form('currencies', 'currencies.php', 'page=' . $_GET['page'] . (isset($cInfo) ? '&cID=' . $cInfo->currencies_id : '') . '&action=insert')]; | CWE-79 | 1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.