code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
function getUserPartForHeader() { global $i18n; if (!$this->id) return null; $user_part = htmlspecialchars($this->name); $user_part .= ' - '.htmlspecialchars($this->role_name); if ($this->behalf_id) { $user_part .= ' <span class="onBehalf">'.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_name).'</span>'; } if ($this->behalf_group_id) { $user_part .= ', <span class="onBehalf">'.htmlspecialchars($this->behalf_group_name).'</span>'; } else { if ($this->group_name) // Note: we did not require group names in the past. $user_part .= ', '.$this->group_name; } return $user_part; }
CWE-79
1
static function validUTF($string) { if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { return false; } return true; }
CWE-89
0
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
static function convertXMLFeedSafeChar($str) { $str = str_replace("<br>","",$str); $str = str_replace("</br>","",$str); $str = str_replace("<br/>","",$str); $str = str_replace("<br />","",$str); $str = str_replace("&quot;",'"',$str); $str = str_replace("&#39;","'",$str); $str = str_replace("&rsquo;","'",$str); $str = str_replace("&lsquo;","'",$str); $str = str_replace("&#174;","",$str); $str = str_replace("�","-", $str); $str = str_replace("�","-", $str); $str = str_replace("�", '"', $str); $str = str_replace("&rdquo;",'"', $str); $str = str_replace("�", '"', $str); $str = str_replace("&ldquo;",'"', $str); $str = str_replace("\r\n"," ",$str); $str = str_replace("�"," 1/4",$str); $str = str_replace("&#188;"," 1/4", $str); $str = str_replace("�"," 1/2",$str); $str = str_replace("&#189;"," 1/2",$str); $str = str_replace("�"," 3/4",$str); $str = str_replace("&#190;"," 3/4",$str); $str = str_replace("�", "(TM)", $str); $str = str_replace("&trade;","(TM)", $str); $str = str_replace("&reg;","(R)", $str); $str = str_replace("�","(R)",$str); $str = str_replace("&","&amp;",$str); $str = str_replace(">","&gt;",$str); return trim($str); }
CWE-89
0
public static function incBack($vars) { $file = GX_PATH.'/inc/lib/Control/Backend/'.$vars.'.control.php'; if ( file_exists($file) ) { # code... include($file); }else{ self::error('404'); } }
CWE-89
0
foreach ($data['alertDanger'] as $alert) { # code... echo "<li>$alert</li>\n"; }
CWE-89
0
protected function copy($src, $dst, $name) { $srcStat = $this->stat($src); $this->clearcache(); if (!empty($srcStat['thash'])) { $target = $this->decode($srcStat['thash']); if (!$this->inpathCE($target, $this->root)) { return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']), elFinder::ERROR_MKOUTLINK); } $stat = $this->stat($target); $this->clearcache(); return $stat && $this->symlinkCE($target, $dst, $name) ? $this->joinPathCE($dst, $name) : $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash'])); } if ($srcStat['mime'] == 'directory') { $test = $this->stat($this->joinPathCE($dst, $name)); $this->clearcache(); if (($test && $test['mime'] != 'directory') || (! $test = $this->mkdir($this->encode($dst), $name))) { return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash'])); } $dst = $this->decode($test['hash']); foreach ($this->getScandir($src) as $stat) { if (empty($stat['hidden'])) { $name = $stat['name']; $_src = $this->decode($stat['hash']); if (! $this->copy($_src, $dst, $name)) { $this->remove($dst, true); // fall back return $this->setError($this->error, elFinder::ERROR_COPY, $this->_path($src)); } } } $this->clearcache(); return $dst; } if ($res = $this->convEncOut($this->_copy($this->convEncIn($src), $this->convEncIn($dst), $this->convEncIn($name)))) { return is_string($res)? $res : $this->joinPathCE($dst, $name); } return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash'])); }
CWE-89
0
function delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->params['date_id'], 'event' => $item, )); } else { // Process a regular delete $item->delete(); } }
CWE-89
0
public function whereFileName($fileName) { $this->selectSingle = $this->model->getFileNameParts($fileName); return $this; }
CWE-22
2
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') { $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; } }
CWE-79
1
public function update() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $values = $this->request->getValues(); list($valid, $errors) = $this->tagValidator->validateModification($values); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($valid) { if ($this->tagModel->update($values['id'], $values['name'])) { $this->flash->success(t('Tag updated successfully.')); } else { $this->flash->failure(t('Unable to update this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); } else { $this->edit($values, $errors); } }
CWE-639
9
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
CWE-89
0
'data' => str_replace(array_keys($tags), array_values($tags), $content), 'status' => array(), 'type' => 'text/html; charset=UTF-8' ) ); }
CWE-79
1
public function activate_discount(){ if (isset($this->params['id'])) { $discount = new discounts($this->params['id']); $discount->update($this->params); //if ($discount->discountulator->hasConfig() && empty($discount->config)) { //flash('messages', $discount->discountulator->name().' requires configuration. Please do so now.'); //redirect_to(array('controller'=>'billing', 'action'=>'configure', 'id'=>$discount->id)); //} } expHistory::back(); }
CWE-89
0
public function testIsActivePhp53() { if (PHP_VERSION_ID >= 50400) { $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } $this->assertFalse($this->proxy->isActive()); }
CWE-89
0
public function rules() { return [ 'name' => 'required', 'email' => 'required|email', 'address' => '', 'primary_number' => 'numeric', 'secondary_number' => 'numeric', 'password' => 'sometimes', 'password_confirmation' => 'sometimes', 'image_path' => '', 'departments' => 'required' ]; }
CWE-521
4
public function authenticate($user, $pass) { global $DB; $user = trim($user); $user = mb_strtolower($user); $A1 = md5($user.':'.APP_REALM.':'.$pass); if($DB->query('SELECT * FROM nv_users WHERE LOWER(username) = '.protect($user))) { $data = $DB->result(); if($data[0]->password==$A1) { $this->load_from_resultset($data[0]); $this->attempts = 0; $this->update(); return true; } else if(!empty($data[0]->id)) { $this->load_from_resultset($data[0]); $this->attempts++; if($this->attempts > 9) $this->blocked = 1; $this->update(); return false; } } return false; }
CWE-89
0
public static function cleanLink($fulllink) { if(substr($fulllink, -1) == '/') $fulllink = substr($fulllink, 0, -1); return $fulllink; }
CWE-89
0
static function description() { return "Manage events and schedules, and optionally publish them."; }
CWE-89
0
$event = mysqli_fetch_assoc($result); if($queue == "active"){ $ged_command = "-drop -type $ged_type_nbr -queue $queue "; foreach ($array_ged_packets as $key => $value) { if($value["key"] == true){ $ged_command .= "\"".$event[$key]."\" "; } } $ged_command = trim($ged_command, " "); shell_exec($path_ged_bin." ".$ged_command); logging("ged_update",$ged_command); } else { $id_list .= $id.","; } } if($queue == "history"){ $id_list = trim($id_list, ","); $ged_command = "-drop -id ".$id_list." -queue history"; shell_exec($path_ged_bin." ".$ged_command); logging("ged_update",$ged_command); } }
CWE-78
6
public function setRssValues($rss) { $this->set('rsstitle', \App\Purifier::purifyByType((string) $rss->title, 'Text')); $this->set('url', $rss->link); }
CWE-79
1
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_replace("\r\n"," ",$str); $str = str_replace('"',"&quot;",$str); $str = str_replace("'","&#39;",$str); $str = str_replace("’","&rsquo;",$str); $str = str_replace("‘","&lsquo;",$str); $str = str_replace("®","&#174;",$str); $str = str_replace("–","-", $str); $str = str_replace("—","&#151;", $str); $str = str_replace("”","&rdquo;", $str); $str = str_replace("“","&ldquo;", $str); $str = str_replace("¼","&#188;",$str); $str = str_replace("½","&#189;",$str); $str = str_replace("¾","&#190;",$str); $str = str_replace("™","&trade;", $str); $str = trim($str); if ($unescape) { $str = stripcslashes($str); } else { $str = addslashes($str); } return $str; }
CWE-89
0
protected function _rmdir($path) { return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows; }
CWE-89
0
public static function isPublic($s) { if ($s == null) { return false; } while ($s->public && $s->parent > 0) { $s = new section($s->parent); } $lineage = (($s->public) ? 1 : 0); return $lineage; }
CWE-89
0
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
self::get($arr); } else { self::incFront('default'); } }
CWE-89
0
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_DELETE, 'fas fa-trash', null, 'primary', null, 'btn-danger xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('testimonials.php', 'page=' . $_GET['page'] . '&tID=' . $tInfo->testimonials_id), null, null, 'btn-light')];
CWE-79
1
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-79
1
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 static function canView($section) { global $db; if ($section == null) { return false; } if ($section->public == 0) { // Not a public section. Check permissions. return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id)); } else { // Is public. check parents. if ($section->parent <= 0) { // Out of parents, and since we are still checking, we haven't hit a private section. return true; } else { $s = $db->selectObject('section', 'id=' . $section->parent); return self::canView($s); } } }
CWE-89
0
function escape_command($command) { return preg_replace("/(\\\$|`)/", "", $command); }
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
$criteria->addCondition ( 'user IN (' . 'SELECT DISTINCT b.username ' . 'FROM x2_group_to_user a JOIN x2_group_to_user b ' . 'ON a.groupId=b.groupId ' . 'WHERE a.username=:getAccessCriteria_username' . ') OR (user = :getAccessCriteria_username)'); } else { // default history privacy (public or assigned) $criteria->addCondition ("(user=:getAccessCriteria_username OR visibility=1)"); } } if ($profile) { $criteria->params[':getAccessCriteria_profileUsername'] = $profile->username; /* only show events associated with current profile which current user has permission to see */ $criteria->addCondition ("user=:getAccessCriteria_profileUsername"); if (!Yii::app()->params->isAdmin) { $criteria->addCondition ("visibility=1"); } } return $criteria; }
CWE-79
1
protected function getTestFile($fileName) { return new \Illuminate\Http\UploadedFile(base_path('tests/test-data/test-file.txt'), $fileName, 'text/plain', 55, null, true); }
CWE-79
1
$dt = date('Y-m-d', strtotime($match)); $sql = par_rep("/'$match'/", "'$dt'", $sql); } } if (substr($sql, 0, 6) == "BEGIN;") { $array = explode(";", $sql); foreach ($array as $value) { if ($value != "") { $result = $connection->query($value); if (!$result) { $connection->query("ROLLBACK"); die(db_show_error($sql, _dbExecuteFailed, mysql_error())); } } } } else { $result = $connection->query($sql) or die(db_show_error($sql, _dbExecuteFailed, mysql_error())); } break; }
CWE-79
1
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_products WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); exit; }
CWE-79
1
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 ) { wp_load_translations_early(); _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 ( is_array( $args[0] ) && count( $args ) == 1 ) { $args = $args[0]; } foreach ( $args as $arg ) { if ( ! is_scalar( $arg ) && ! is_null( $arg ) ) { wp_load_translations_early(); _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'Unsupported value type (%s).' ), gettype( $arg ) ), '4.8.2' ); } } $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 $query = preg_replace( '/%(?:%|$|([^dsF]))/', '%%\\1', $query ); // escape any unescaped percents // Count the number of valid placeholders in the query $placeholders = preg_match_all( '/(^|[^%]|(%%)+)%[sdF]/', $query, $matches ); if ( count ( $args ) !== $placeholders ) { wp_load_translations_early(); _doing_it_wrong( 'wpdb::prepare', /* translators: 1: number of placeholders, 2: number of arguments passed */ sprintf( __( 'The query does not contain the correct number of placeholders (%1$d) for the number of arguments passed (%2$d).' ), $placeholders, count( $args ) ), '4.9.0' ); } array_walk( $args, array( $this, 'escape_by_ref' ) ); return @vsprintf( $query, $args ); }
CWE-89
0
function update_vendor() { $vendor = new vendor(); $vendor->update($this->params['vendor']); expHistory::back(); }
CWE-89
0
public static function ridOld($tokens) { $time = time(); foreach ($tokens as $token => $value) { if ($time - $value['time'] > 3600) { unset($tokens[$token]); } } return $tokens; }
CWE-89
0
public function manage_messages() { expHistory::set('manageable', $this->params); $page = new expPaginator(array( 'model'=>'order_status_messages', 'where'=>1, 'limit'=>10, 'order'=>'body', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); //eDebug($page); assign_to_template(array( 'page'=>$page )); }
CWE-89
0
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
public function getQuerySelect() { return "R_{$this->id}.rank AS `$this->name`"; }
CWE-89
0
foreach ($data['alertred'] as $alert) { # code... echo "<li>$alert</li>\n"; }
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 function addFile($filename, $conditional_ie = false) { $hash = md5($filename); if (!empty($this->_files[$hash])) { return; } $has_onload = $this->_eventBlacklist($filename); $this->_files[$hash] = array( 'has_onload' => $has_onload, 'filename' => $filename, 'conditional_ie' => $conditional_ie ); }
CWE-79
1
public function testGetFilteredEventsDataProvider () { TestingAuxLib::loadX2NonWebUser (); TestingAuxLib::suLogin ('testuser'); Yii::app()->settings->historyPrivacy = null; $profile = Profile::model()->findByAttributes(array('username' => 'testuser')); $retVal = Events::getFilteredEventsDataProvider ($profile, true, null, false); $dataProvider = $retVal['dataProvider']; $events = $dataProvider->getData (); $expectedEvents = Events::getEvents (0, 0, count ($events), $profile); // verify events from getData $this->assertEquals ( Yii::app()->db->createCommand (" select id from x2_events where user='testuser' or visibility order by timestamp desc, id desc ")->queryColumn (), array_map ( function ($event) { return $event->id; }, $expectedEvents['events'] ) ); // ensure that getFilteredEventsDataProvider returns same events as getData $this->assertEquals ( array_map ( function ($event) { return $event->id; }, $expectedEvents['events'] ), array_map ( function ($event) { return $event->id; }, $events ) ); TestingAuxLib::restoreX2WebUser (); }
CWE-79
1
function db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '(')); if (!$pos = strpos($row['TYPE'], ',')) $pos = strpos($row['TYPE'], ')'); else $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1); $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos); if ($row['NULL'] != '') $properties[strtoupper($row['FIELD'])]['NULL'] = "Y"; else $properties[strtoupper($row['FIELD'])]['NULL'] = "N"; } break; } return $properties; }
CWE-22
2
static function testLDAPConnection($auths_id, $replicate_id = -1) { $config_ldap = new self(); $res = $config_ldap->getFromDB($auths_id); // we prevent some delay... if (!$res) { return false; } //Test connection to a replicate if ($replicate_id != -1) { $replicate = new AuthLdapReplicate(); $replicate->getFromDB($replicate_id); $host = $replicate->fields["host"]; $port = $replicate->fields["port"]; } else { //Test connection to a master ldap server $host = $config_ldap->fields['host']; $port = $config_ldap->fields['port']; } $ds = self::connectToServer($host, $port, $config_ldap->fields['rootdn'], Toolbox::decrypt($config_ldap->fields['rootdn_passwd'], GLPIKEY), $config_ldap->fields['use_tls'], $config_ldap->fields['deref_option']); if ($ds) { return true; } return false; }
CWE-798
18
function unlockTables() { $sql = "UNLOCK TABLES"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0
public function confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $swimlane, ))); }
CWE-639
9
public function backup($type='json') { global $DB; global $website; $DB->query('SELECT * FROM nv_payment_methods WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; }
CWE-89
0
protected function _unlink($path) { return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime!="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows; }
CWE-89
0
$section = new section(intval($page)); if ($section) { // self::deleteLevel($section->id); $section->delete(); } } }
CWE-89
0
$links[] = CHtml::link(CHtml::encode($tag->tag),array('/search/search','term'=>CHtml::encode($tag->tag)));
CWE-79
1
protected static function localScandir($dir) { // PHP function scandir() is not work well in specific environment. I dont know why. // ref. https://github.com/Studio-42/elFinder/issues/1248 $files = array(); if ($dh = opendir($dir)) { while (false !== ($file = readdir($dh))) { if ($file !== '.' && $file !== '..') { $files[] = $file; } } closedir($dh); } else { $this->setError('Can not open local directory.'); } return $files; }
CWE-89
0
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-639
9
public function __construct(ImageService $imageService, PdfGenerator $pdfGenerator) { $this->imageService = $imageService; $this->pdfGenerator = $pdfGenerator; }
CWE-79
1
public function manage() { expHistory::set('viewable', $this->params); $page = new expPaginator(array( 'model'=>'order_status', 'where'=>1, 'limit'=>10, 'order'=>'rank', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); assign_to_template(array( 'page'=>$page )); }
CWE-89
0
public static function secure() { if (!isset($_SESSION['gxsess']['val']['loggedin']) && !isset($_SESSION['gxsess']['val']['username']) ) { header('location: login.php'); } else { return true; } }
CWE-89
0
public static function loadonce($var){ require_once(GX_LIB."Vendor/".$var); }
CWE-89
0
public function LoadHashPaths($tree) { if (!$tree) return; $treePaths = array(); $blobPaths = array(); $args = array(); $args[] = '--full-name'; $args[] = '-r'; $args[] = '-t'; $args[] = $tree->GetHash(); $lines = explode("\n", $this->exe->Execute($tree->GetProject()->GetPath(), GIT_LS_TREE, $args)); foreach ($lines as $line) { if (preg_match("/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/", $line, $regs)) { switch ($regs[2]) { case 'tree': $treePaths[trim($regs[4])] = $regs[3]; break; case 'blob'; $blobPaths[trim($regs[4])] = $regs[3]; break; } } } return array( $treePaths, $blobPaths ); }
CWE-78
6
$percent = round($percent, 0); } else { $percent = round($percent, 2); // school default } if ($ret == '%') return $percent; if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id]) $_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TITLE,ID,BREAK_OFF FROM report_card_grades WHERE SYEAR=\'' . $cp[1]['SYEAR'] . '\' AND SCHOOL_ID=\'' . $cp[1]['SCHOOL_ID'] . '\' AND GRADE_SCALE_ID=\'' . $grade_scale_id . '\' ORDER BY BREAK_OFF IS NOT NULL DESC,BREAK_OFF DESC,SORT_ORDER')); foreach ($_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] as $grade) { if ($does_breakoff == 'Y' ? $percent >= $programconfig[$staff_id][$course_period_id . '-' . $grade['ID']] && is_numeric($programconfig[$staff_id][$course_period_id . '-' . $grade['ID']]) : $percent >= $grade['BREAK_OFF']) return $ret == 'ID' ? $grade['ID'] : $grade['TITLE']; } }
CWE-79
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully.')); } else { $this->flash->failure(t('Unable to remove this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
CWE-639
9
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
CWE-89
0
public function wipecache() { $type = $this->request->request("type"); switch ($type) { case 'all': case 'content': rmdirs(CACHE_PATH, false); Cache::clear(); if ($type == 'content') break; case 'template': rmdirs(TEMP_PATH, false); if ($type == 'template') break; case 'addons': Service::refresh(); if ($type == 'addons') break; } \think\Hook::listen("wipecache_after"); $this->success(); }
CWE-89
0
static function isSearchable() { return true; }
CWE-89
0
public function update() { global $user; if (expSession::get('customer-signup')) expSession::set('customer-signup', false); if (isset($this->params['address_country_id'])) { $this->params['country'] = $this->params['address_country_id']; unset($this->params['address_country_id']); } if (isset($this->params['address_region_id'])) { $this->params['state'] = $this->params['address_region_id']; unset($this->params['address_region_id']); } if ($user->isLoggedIn()) { // check to see how many other addresses this user has already. $count = $this->address->find('count', 'user_id='.$user->id); // if this is first address save for this user we'll make this the default if ($count == 0) { $this->params['is_default'] = 1; $this->params['is_billing'] = 1; $this->params['is_shipping'] = 1; } // associate this address with the current user. $this->params['user_id'] = $user->id; // save the object $this->address->update($this->params); } else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){ //user is not logged in, but allow anonymous checkout is enabled so we'll check //a few things that we don't check in the parent 'stuff and create a user account. $this->params['is_default'] = 1; $this->params['is_billing'] = 1; $this->params['is_shipping'] = 1; $this->address->update($this->params); } expHistory::back(); }
CWE-89
0
$controller = new $ctlname(); if (method_exists($controller,'isSearchable') && $controller->isSearchable()) { // $mods[$controller->name()] = $controller->addContentToSearch(); $mods[$controller->searchName()] = $controller->addContentToSearch(); } } uksort($mods,'strnatcasecmp'); assign_to_template(array( 'mods'=>$mods )); }
CWE-89
0
} elseif (!is_numeric($item) && ($item != '')) { return false; } } } else { return false; } } else {
CWE-787
24
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'parent' => $parent, 'isAdministrator' => $user->isAdmin(), )); }
CWE-89
0
public function __construct() { global $GLOBALS, $data; self::$editors =& $GLOBALS; self::$data =& $data; self::$url = Options::v('siteurl'); self::$domain = Options::v('sitedomain'); self::$name = Options::v('sitename'); self::$key = Options::v('sitekeywords'); self::$desc = Options::v('sitedesc'); self::$email = Options::v('siteemail'); self::$slogan = Options::v('siteslogan'); }
CWE-89
0
public function approve_submit() { global $history; if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); $lastUrl = expHistory::getLast('editable'); } /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; $simplenote = new expSimpleNote($this->params['id']); //FIXME here is where we might sanitize the note before approving it $simplenote->body = $this->params['body']; $simplenote->approved = $this->params['approved']; $simplenote->save(); $lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
CWE-89
0
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Action removed successfully.')); } else { $this->flash->failure(t('Unable to remove this action.')); } $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id']))); }
CWE-639
9
protected function encode($path) { if ($path !== '') { // cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root $p = $this->relpathCE($path); // if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt if ($p === '') { $p = DIRECTORY_SEPARATOR; } // TODO crypt path and return hash $hash = $this->crypt($p); // hash is used as id in HTML that means it must contain vaild chars // make base64 html safe and append prefix in begining $hash = strtr(base64_encode($hash), '+/=', '-_.'); // remove dots '.' at the end, before it was '=' in base64 $hash = rtrim($hash, '.'); // append volume id to make hash unique return $this->id.$hash; } }
CWE-89
0
function nvweb_product_comments_count($object_id = NULL) { global $DB; global $website; global $current; if(empty($object_id)) $object_id = $current['object']->id; $DB->query('SELECT COUNT(*) as total FROM nv_comments WHERE website = '.protect($website->id).' AND object_type = "product" AND object_id = '.protect($object_id).' AND status = 0' ); $out = $DB->result('total'); return $out[0]; }
CWE-89
0
public function actionGetItems($modelType){ $sql = 'SELECT id, name as value FROM x2_campaigns WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = '%'.$_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); exit; }
CWE-79
1
function db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($row['TYPE'], strpos($row['TYPE'], '(')); if (!$pos = strpos($row['TYPE'], ',')) $pos = strpos($row['TYPE'], ')'); else $properties[strtoupper($row['FIELD'])]['SCALE'] = substr($row['TYPE'], $pos + 1); $properties[strtoupper($row['FIELD'])]['SIZE'] = substr($row['TYPE'], strpos($row['TYPE'], '(') + 1, $pos); if ($row['NULL'] != '') $properties[strtoupper($row['FIELD'])]['NULL'] = "Y"; else $properties[strtoupper($row['FIELD'])]['NULL'] = "N"; } break; } return $properties; }
CWE-79
1
$post = Db::query("UPDATE `options` SET `value`='{$v}' WHERE `name` = '{$k}' LIMIT 1"); } }else{ $post = Db::query("UPDATE `options` SET `value`='{$val}' WHERE `name` = '{$key}' LIMIT 1"); } return $post; }
CWE-89
0
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
CWE-639
9
public function __construct(){ }
CWE-89
0
function VerifyVariableSchedule($columns) { // $teacher=$columns['TEACHER_ID']; // $secteacher=$columns['SECONDARY_TEACHER_ID']; // if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='') // $all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); // else // $all_teacher=($secteacher!=''?$secteacher:''); $teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']:$columns['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']:$columns['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
$file = explode('.', $lang); if ($var == $file[0]) { $sel = 'SELECTED'; }else{ $sel = ''; } $opt .= "<option {$sel}>{$file[0]}</option>"; } return $opt; }
CWE-89
0
public function confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $swimlane, ))); }
CWE-639
9
function PMA_getColumnsList($db, $from=0, $num=25) { $cfgCentralColumns = PMA_centralColumnsGetParams(); if (empty($cfgCentralColumns)) { return array(); } $pmadb = $cfgCentralColumns['db']; $GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']); $central_list_table = $cfgCentralColumns['table']; //get current values of $db from central column list if ($num == 0) { $query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' ' . 'WHERE db_name = \'' . $db . '\';'; } else { $query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' ' . 'WHERE db_name = \'' . $db . '\' ' . 'LIMIT ' . $from . ', ' . $num . ';'; } $has_list = (array) $GLOBALS['dbi']->fetchResult( $query, null, null, $GLOBALS['controllink'] ); PMA_handleColumnExtra($has_list); return $has_list; }
CWE-89
0
public function load($id) { try { $select = $this->zdb->select(self::TABLE); $select->where(self::PK . ' = ' . $id); $results = $this->zdb->execute($select); $result = $results->current(); if ($result) { $this->loadFromRs($result); } } catch (Throwable $e) { Analog::log( 'Unable to retrieve field type for field ' . $id . ' | ' . $e->getMessage(), Analog::ERROR ); } }
CWE-89
0
protected function _mkdir($path, $name) { $path = $this->_joinPath($path, $name); if ($this->connect->mkdir($path) === false) { return false; } $this->options['dirMode'] && $this->connect->chmod($this->options['dirMode'], $path); return $path; }
CWE-22
2
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 'mysqil': $errormessage = mysqli_error($connection); break; } db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errormessage); } return $connection; }
CWE-79
1
protected function mkdir($args) { $target = $args['target']; $name = $args['name']; if (($volume = $this->volume($target)) == false) { return array('error' => $this->error(self::ERROR_MKDIR, $name, self::ERROR_TRGDIR_NOT_FOUND, '#'.$target)); } return ($dir = $volume->mkdir($target, $name)) == false ? array('error' => $this->error(self::ERROR_MKDIR, $name, $volume->error())) : array('added' => array($dir)); }
CWE-89
0
public static function getHelpVersionId($version) { global $db; return $db->selectValue('help_version', 'id', 'version="'.$version.'"'); }
CWE-89
0
static function description() { return gt("Places navigation links/menus on the page."); }
CWE-89
0
protected function fsock_get_contents( &$url, $timeout, $redirect_max, $ua, $outfp ) { $connect_timeout = 3; $connect_try = 3; $method = 'GET'; $readsize = 4096; $getSize = null; $headers = ''; $arr = parse_url($url); if (!$arr){ // Bad request return false; } // query $arr['query'] = isset($arr['query']) ? '?'.$arr['query'] : ''; // port $arr['port'] = isset($arr['port']) ? $arr['port'] : (!empty($arr['https'])? 443 : 80); $url_base = $arr['scheme'].'://'.$arr['host'].':'.$arr['port']; $url_path = isset($arr['path']) ? $arr['path'] : '/'; $uri = $url_path.$arr['query']; $query = $method.' '.$uri." HTTP/1.0\r\n"; $query .= "Host: ".$arr['host']."\r\n"; if (!empty($ua)) $query .= "User-Agent: ".$ua."\r\n"; if (!is_null($getSize)) $query .= 'Range: bytes=0-' . ($getSize - 1) . "\r\n";
CWE-89
0
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->getId()) { throw new AccessForbiddenException(); } return $comment; }
CWE-639
9
protected function driverRead(CacheItemInterface $item) { $this->driverConnect(); // return null if no caching // return value if in caching $keyword = self::PREFIX . $item->getKey(); $x = isset($_COOKIE[ $keyword ]) ? $this->decode(json_decode($_COOKIE[ $keyword ], true)) : false; if ($x == false) { return null; } else { if (!is_scalar($this->driverUnwrapData($x)) && !is_null($this->driverUnwrapData($x))) { throw new phpFastCacheDriverException('Hacking attempt: The decoding returned a non-scalar value, Cookie driver does not allow this.'); } return $x; } }
CWE-502
15
public static function makeConfig ($file) { $config = "<?php if(!defined('GX_LIB')) die(\"Direct Access Not Allowed!\"); /** * GeniXCMS - Content Management System * * PHP Based Content Management System and Framework * * @package GeniXCMS * @since 0.0.1 build date 20140925 * @version 0.0.1 * @link https://github.com/semplon/GeniXCMS * @author Puguh Wijayanto (www.metalgenix.com) * @copyright 2014-2015 Puguh Wijayanto * @license http://www.opensource.org/licenses/mit-license.php MIT * */ // DB CONFIG define('DB_HOST', '".Session::val('dbhost')."'); define('DB_NAME', '".Session::val('dbname')."'); define('DB_PASS', '".Session::val('dbpass')."'); define('DB_USER', '".Session::val('dbuser')."'); define('DB_DRIVER', 'mysqli'); define('THEME', 'default'); define('GX_LANG', 'english'); define('SMART_URL', false); //set 'true' if you want use SMART URL (SEO Friendly URL) define('GX_URL_PREFIX', '.html'); define('SECURITY', '".Typo::getToken(200)."'); // for security purpose, will be used for creating password "; try{ $f = fopen($file, "w"); $c = fwrite($f, $config); fclose($f); }catch (Exception $e) { echo $e->getMessage(); } return $config; }
CWE-79
1
public function &storeicms_ipf_ObjectD() { return $this->storeicms_ipf_Object(true); }
CWE-22
2
public function getMissingAmount() { if (empty($this->_id)) { return (double)$this->amount; } try { $select = $this->zdb->select(Contribution::TABLE); $select->columns( array( 'sum' => new Expression('SUM(montant_cotis)') ) )->where(self::PK . ' = ' . $this->_id); $results = $this->zdb->execute($select); $result = $results->current(); $dispatched_amount = $result->sum; return (double)$this->_amount - (double)$dispatched_amount; } catch (Throwable $e) { Analog::log( 'An error occurred retrieving missing amounts | ' . $e->getMessage(), Analog::ERROR ); throw $e; } }
CWE-89
0
function draw_cdef_preview($cdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>cdef=<?php print get_cdef($cdef_id, true);?></pre> </td> </tr> <?php }
CWE-79
1
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 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 testXssExternalLinkImg() { $antiXss = new \MicroweberPackages\Helper\HTMLClean(); $string = '<img src="'.site_url().'test.jpg" />'; $content = $antiXss->clean($string); $this->assertEquals('<img src="'.site_url().'test.jpg" alt="test.jpg" />', $content); $string = '<img src="https://google.bg/test.jpg" />'; $content = $antiXss->clean($string); $this->assertEquals('', $content); }
CWE-79
1