code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
public function fetchFormFromTemplate($id) { }
CWE-94
14
function process_subsections($parent_section, $subtpl) { global $db, $router; $section = new stdClass(); $section->parent = $parent_section->id; $section->name = $subtpl->name; $section->sef_name = $router->encode($section->name); $section->subtheme = $subtpl->subtheme; $section->active = $subtpl->active; $section->public = $subtpl->public; $section->rank = $subtpl->rank; $section->page_title = $subtpl->page_title; $section->keywords = $subtpl->keywords; $section->description = $subtpl->description; $section->id = $db->insertObject($section, 'section'); self::process_section($section, $subtpl); }
CWE-89
0
public function __construct(Image $image, File $file, ImageRepo $imageRepo) { $this->image = $image; $this->file = $file; $this->imageRepo = $imageRepo; }
CWE-22
2
function audit($method, $class, $statement, $formats, $values, $users_id) { $this->method = $method; $this->class = $class; $this->statement = substr(str_replace("'", "", $statement),0,1000)."n"; $this->formats = $formats; $this->values = $values; $this->ip = getRealIpAddr(); $this->users_id = empty($users_id)?"NULL":$users_id; return $this->save(); }
CWE-89
0
public static function data($vars){ $file = GX_THEME.'/'.$vars.'/themeinfo.php'; $handle = fopen($file, 'r'); $data = fread($handle, filesize($file)); fclose($handle); preg_match('/\* Name: (.*)\n\*/U', $data, $matches); $d['name'] = $matches[1]; preg_match('/\* Desc: (.*)\n\*/U', $data, $matches); $d['desc'] = $matches[1]; preg_match('/\* Version: (.*)\n\*/U', $data, $matches); $d['version'] = $matches[1]; preg_match('/\* Build: (.*)\n\*/U', $data, $matches); $d['build'] = $matches[1]; preg_match('/\* Developer: (.*)\n\*/U', $data, $matches); $d['developer'] = $matches[1]; preg_match('/\* URI: (.*)\n\*/U', $data, $matches); $d['url'] = $matches[1]; preg_match('/\* License: (.*)\n\*/U', $data, $matches); $d['license'] = $matches[1]; preg_match('/\* Icon: (.*)\n\*/U', $data, $matches); $d['icon'] = $matches[1]; return $d; }
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
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
public function uploadCompanyLogo(Request $request) { $company = Company::find($request->header('company')); $this->authorize('manage company', $company); $data = json_decode($request->company_logo); if ($data) { $company = Company::find($request->header('company')); if ($company) { $company->clearMediaCollection('logo'); $company->addMediaFromBase64($data->data) ->usingFileName($data->name) ->toMediaCollection('logo'); } } return response()->json([ 'success' => true, ]); }
CWE-79
1
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
CWE-639
9
protected function _filePutContents($path, $content) { $res = false; if ($this->tmp) { $local = $this->getTempFile(); if (@file_put_contents($local, $content, LOCK_EX) !== false && ($fp = @fopen($local, 'rb'))) { clearstatcache(); $res = ftp_fput($this->connect, $path, $fp, $this->ftpMode($path)); @fclose($fp); } file_exists($local) && @unlink($local); } return $res; }
CWE-89
0
$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
$src = substr($ref->source, strlen($prefix)) . $section->id; if (call_user_func(array($ref->module, 'hasContent'))) { $oloc = expCore::makeLocation($ref->module, $ref->source); $nloc = expCore::makeLocation($ref->module, $src); if ($ref->module != "container") { call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc); } else { call_user_func(array($ref->module, 'copyContent'), $oloc, $nloc, $section->id); } } }
CWE-89
0
function path_f ($path) { global $home_dir; $abs_dir = $home_dir; switch ($path) { case '.': case '': return realpath($abs_dir); } return realpath(realpath($home_dir) . "/$path"); }
CWE-22
2
function load_gallery($auc_id) { $UPLOADED_PICTURES = array(); if (is_dir(UPLOAD_PATH . $auc_id)) { if ($dir = opendir(UPLOAD_PATH . $auc_id)) { while ($file = @readdir($dir)) { if ($file != '.' && $file != '..' && strpos($file, 'thumb-') === false) { $UPLOADED_PICTURES[] = UPLOAD_FOLDER . $auc_id . '/' . $file; } } closedir($dir); } } return $UPLOADED_PICTURES; }
CWE-22
2
public static function exist($tag) { $sql = "SELECT `name` FROM `cat` WHERE `name` = '{$tag}'"; $q = Db::result($sql); if (Db::$num_rows > 0) { return true; }else{ return false; } }
CWE-89
0
function change_pass() { global $txp_user; extract(psa(array('new_pass', 'mail_password'))); if (empty($new_pass)) { author_list(array(gTxt('password_required'), E_ERROR)); return; } $rs = change_user_password($txp_user, $new_pass); if ($rs) { $message = gTxt('password_changed'); if ($mail_password) { $email = fetch('email', 'txp_users', 'name', $txp_user); send_new_password($new_pass, $email, $txp_user); $message .= sp.gTxt('and_mailed_to').sp.$email; } $message .= '.'; author_list($message); } }
CWE-521
4
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
CWE-89
0
function captureAuthorization() { //eDebug($this->params,true); $order = new order($this->params['id']); /*eDebug($this->params); //eDebug($order,true);*/ //eDebug($order,true); //$billing = new billing(); //eDebug($billing, true); //$billing->calculator = new $calcname($order->billingmethod[0]->billingcalculator_id); $calc = $order->billingmethod[0]->billingcalculator->calculator; $calc->config = $order->billingmethod[0]->billingcalculator->config; //$calc = new $calc- //eDebug($calc,true); if (!method_exists($calc, 'delayed_capture')) { flash('error', gt('The Billing Calculator does not support delayed capture')); expHistory::back(); } $result = $calc->delayed_capture($order->billingmethod[0], $this->params['capture_amt'], $order); if (empty($result->errorCode)) { flash('message', gt('The authorized payment was successfully captured')); expHistory::back(); } else { flash('error', gt('An error was encountered while capturing the authorized payment.') . '<br /><br />' . $result->message); expHistory::back(); } }
CWE-89
0
public function Connect ($host, $port = false, $tval = 30) { // Are we already connected? if ($this->connected) { return true; } /* On Windows this will raise a PHP Warning error if the hostname doesn't exist. Rather than supress it with @fsockopen, let's capture it cleanly instead */ set_error_handler(array(&$this, 'catchWarning')); // Connect to the POP3 server $this->pop_conn = fsockopen($host, // POP3 Host $port, // Port # $errno, // Error Number $errstr, // Error Message $tval); // Timeout (seconds) // Restore the error handler restore_error_handler(); // Does the Error Log now contain anything? if ($this->error && $this->do_debug >= 1) { $this->displayErrors(); } // Did we connect? if ($this->pop_conn == false) { // It would appear not... $this->error = array( 'error' => "Failed to connect to server $host on port $port", 'errno' => $errno, 'errstr' => $errstr ); if ($this->do_debug >= 1) { $this->displayErrors(); } return false; } // Increase the stream time-out // Check for PHP 4.3.0 or later if (version_compare(phpversion(), '5.0.0', 'ge')) { stream_set_timeout($this->pop_conn, $tval, 0); } else { // Does not work on Windows if (substr(PHP_OS, 0, 3) !== 'WIN') { socket_set_timeout($this->pop_conn, $tval, 0); } } // Get the POP3 server response $pop3_response = $this->getResponse(); // Check for the +OK if ($this->checkResponse($pop3_response)) { // The connection is established and the POP3 server is talking $this->connected = true; return true; } return false; }
CWE-79
1
public static function sessionDataDecode(&$var, $checkIs = null) { if (self::$base64encodeSessionData) { $data = @unserialize(@base64_decode($var)); } else { $data = $var; } $chk = true; if ($checkIs) { switch ($checkIs) { case 'array': $chk = is_array($data); break; case 'string': $chk = is_string($data); break; case 'object': $chk = is_object($data); break; case 'int': $chk = is_int($data); break; } } if (!$chk) { unset($var); return false; } return $data; }
CWE-89
0
protected function itemLock($hashes, $autoUnlock = true) { if (!elFinder::$commonTempPath) { return; } if (!is_array($hashes)) { $hashes = array($hashes); } foreach ($hashes as $hash) { $lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock'; if ($this->itemLocked($hash)) { $cnt = file_get_contents($lock) + 1; } else { $cnt = 1; } if (file_put_contents($lock, $cnt, LOCK_EX)) { if ($autoUnlock) { $this->autoUnlocks[] = $hash; } } } }
CWE-78
6
function _makeChooseCheckbox($value, $title) { global $THIS_RET; // return '<INPUT type=checkbox name=st_arr[] value=' . $value . ' checked>'; return "<input name=unused[$THIS_RET[STUDENT_ID]] value=" . $THIS_RET[STUDENT_ID] . " type='checkbox' id=$THIS_RET[STUDENT_ID] onClick='setHiddenCheckboxStudents(\"st_arr[]\",this,$THIS_RET[STUDENT_ID]);' />"; }
CWE-22
2
public function testVeryLongHosts($host) { $start = microtime(true); $request = Request::create('/'); $request->headers->set('host', $host); $this->assertEquals($host, $request->getHost()); $this->assertLessThan(3, microtime(true) - $start); }
CWE-89
0
public function __construct(public Config $Config, private Sql $Sql) { $this->Db = Db::getConnection(); }
CWE-307
26
public static function insert ($vars) { if(is_array($vars)){ $set = ""; $k = ""; foreach ($vars['key'] as $key => $val) { $set .= "'$val',"; $k .= "`$key`,"; } $set = substr($set, 0,-1); $k = substr($k, 0,-1); $sql = sprintf("INSERT INTO `%s` (%s) VALUES (%s) ", $vars['table'], $k, $set) ; }else{ $sql = $vars; } if(DB_DRIVER == 'mysql') { mysql_query('SET CHARACTER SET utf8'); $q = mysql_query($sql) or die(mysql_error()); self::$last_id = mysql_insert_id(); }elseif(DB_DRIVER == 'mysqli'){ try { if(!self::query($sql)){ printf("<div class=\"alert alert-danger\">Errormessage: %s</div>\n", self::$mysqli->error); }else{ self::$last_id = self::$mysqli->insert_id; } } catch (exception $e) { echo $e->getMessage(); } } return true; }
CWE-89
0
public static function getURI () { $uri = $_SERVER['REQUEST_URI']; // echo $uri; // strip any $_REQUEST variable $uri = explode('?', $uri); if (count($uri) > 0) { unset($uri[1]); } // print_r($uri[0]); if (self::inFolder()) { $uri = self::stripFolder($uri[0]); }else{ $uri2 = explode('/', $uri[0]); unset($uri2[0]); $uri = implode('/', $uri2); } $uri = (Options::v('permalink_use_index_php') == "on")? str_replace("/index.php", "", $uri): $uri; return '/' . trim($uri, '/'); }
CWE-89
0
public function quicksearch($text) { global $DB; global $website; $like = ' LIKE '.protect('%'.$text.'%'); // we search for the IDs at the dictionary NOW (to avoid inefficient requests) $DB->query('SELECT DISTINCT (nvw.node_id) FROM nv_webdictionary nvw WHERE nvw.node_type = "feed" AND nvw.website = '.$website->id.' AND nvw.text '.$like, 'array'); $dict_ids = $DB->result("node_id"); // all columns to look for $cols[] = 'i.id' . $like; if(!empty($dict_ids)) $cols[] = 'i.id IN ('.implode(',', $dict_ids).')'; $where = ' AND ( '; $where.= implode( ' OR ', $cols); $where .= ')'; return $where; }
CWE-79
1
public function checkForReassign($operator) { $operator_name = ($this->locale == get_home_locale()) ? $operator['vclocalename'] : $operator['vccommonname']; $is_operator_correct = $this->nextAgent == $operator['operatorid'] || $this->agentId == $operator['operatorid']; if ($this->state == self::STATE_WAITING && $is_operator_correct) { // Prepare message if ($this->nextAgent == $operator['operatorid']) { $message_to_post = getlocal( "Operator <strong>{0}</strong> changed operator <strong>{1}</strong>", array($operator_name, $this->agentName), $this->locale, true ); } else { $message_to_post = getlocal( "Operator {0} is back", array($operator_name), $this->locale, true ); } // Update thread info $this->state = self::STATE_CHATTING; $this->nextAgent = 0; $this->agentId = $operator['operatorid']; $this->agentName = $operator_name; $this->save(); // Send messages $this->postMessage(self::KIND_EVENTS, $message_to_post); } }
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
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
CWE-639
9
function edit() { global $user; /* The global constants can be overriden by passing appropriate params */ //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['formtitle'])) { if (empty($this->params['id'])) { $formtitle = gt("Add New Note"); } else { $formtitle = gt("Edit Note"); } } else { $formtitle = $this->params['formtitle']; } $id = empty($this->params['id']) ? null : $this->params['id']; $simpleNote = new expSimpleNote($id); //FIXME here is where we might sanitize the note before displaying/editing it assign_to_template(array( 'simplenote'=>$simpleNote, 'user'=>$user, 'require_login'=>$require_login, 'require_approval'=>$require_approval, 'require_notification'=>$require_notification, 'notification_email'=>$notification_email, 'formtitle'=>$formtitle, 'content_type'=>$this->params['content_type'], 'content_id'=>$this->params['content_id'], 'tab'=>empty($this->params['tab'])?0:$this->params['tab'] )); }
CWE-89
0
private function formatResponse($view, $title, $settings, $status = 'ok') { if ($view instanceof View) { $html = $view->__toString(); $show_settings = (int) Str::startsWith($view->getName(), 'widgets.settings.'); } else { $html = (string) $view; $show_settings = (int) $this->show_settings; } return response()->json([ 'status' => $status, 'title' => __($title), 'html' => $html, 'show_settings' => $show_settings, 'settings' => $settings, ]); }
CWE-79
1
private function updateModificationDate() { try { $modif_date = date('Y-m-d'); $update = $this->zdb->update(self::TABLE); $update->set( array('date_modif_adh' => $modif_date) )->where(self::PK . '=' . $this->_id); $edit = $this->zdb->execute($update); $this->_modification_date = $modif_date; } catch (Throwable $e) { Analog::log( 'Something went wrong updating modif date :\'( | ' . $e->getMessage() . "\n" . $e->getTraceAsString(), Analog::ERROR ); throw $e; } }
CWE-89
0
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
protected function assetExtensions() { return [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'ico', 'css', 'js', 'woff', 'woff2', 'svg', 'ttf', 'eot', 'json', 'md', 'less', 'sass', 'scss', 'xml' ]; }
CWE-22
2
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); expHistory::back(); }
CWE-89
0
function nvweb_menu_load_routes() { global $DB; global $structure; global $current; global $website; if(empty($structure['routes'])) { $structure['routes'] = array(); $DB->query('SELECT object_id, path FROM nv_paths WHERE type = "structure" AND lang = '.protect($current['lang']).' AND website = '.$website->id); $data = $DB->result(); if(!is_array($data)) $data = array(); $dictionary = array(); foreach($data as $item) { $structure['routes'][$item->object_id] = $item->path; } } }
CWE-89
0
function scan($dir, $filter = '') { $path = FM_ROOT_PATH.'/'.$dir; $ite = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); $rii = new RegexIterator($ite, "/(".$filter.")/i"); $files = array(); foreach ($rii as $file) { if (!$file->isDir()) { $fileName = $file->getFilename(); $location = str_replace(FM_ROOT_PATH, '', $file->getPath()); $files[] = array( "name" => $fileName, "type" => "file", "path" => $location, ); } } return $files; }
CWE-22
2
$this->params = $this->convertPartsToParams(); } elseif (isset($_SERVER['REQUEST_URI'])) { // if we hit here, we don't really need to do much. All the pertinent info will come thru in the POST/GET vars // so we don't really need to worry about what the URL looks like. if ($_SERVER['REQUEST_URI'] == PATH_RELATIVE) { $this->url_type = 'base'; $this->params = array(); } else { $sefPath = explode('%22%3E',$_SERVER['REQUEST_URI']); // remove any attempts to close the command $_SERVER['REQUEST_URI'] = $sefPath[0]; $this->url_style = 'query'; } } else { $this->url_type = 'base'; $this->params = array(); } // Check if this was a printer friendly link request define('PRINTER_FRIENDLY', (isset($_REQUEST['printerfriendly']) || isset($this->params['printerfriendly'])) ? 1 : 0); define('EXPORT_AS_PDF', (isset($_REQUEST['exportaspdf']) || isset($this->params['exportaspdf'])) ? 1 : 0); define('EXPORT_AS_PDF_LANDSCAPE', (isset($_REQUEST['landscapepdf']) || isset($this->params['landscapepdf'])) ? 1 : 0); }
CWE-89
0
public function __construct($exceptions = false) { $this->exceptions = ($exceptions == true); }
CWE-79
1
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
CWE-639
9
foreach ($cf_d as $cfd_i => $cfd_d) { if ($cfd_i == 'TYPE') { $fc = substr($cfd_d, 0, 1); $lc = substr($cfd_d, 1); $cfd_d = strtoupper($fc) . $lc; $get_schools_cf[$cf_i][$cfd_i] = $cfd_d; unset($fc); unset($lc); } if ($cfd_i == 'SELECT_OPTIONS' && $cf_d['TYPE'] != 'text') { for ($i = 0; $i < strlen($cfd_d); $i++) { $char = substr($cfd_d, $i, 1); if (ord($char) == '13') $char = '<br/>'; $new_char[] = $char; } $cfd_d = implode('', $new_char); $get_schools_cf[$cf_i][$cfd_i] = $cfd_d; unset($char); unset($new_char); } if ($cfd_i == 'SYSTEM_FIELD' || $cfd_i == 'REQUIRED') { if ($cfd_d == 'N') $get_schools_cf[$cf_i][$cfd_i] = 'No'; if ($cfd_d == 'Y') $get_schools_cf[$cf_i][$cfd_i] = 'Yes'; } }
CWE-79
1
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); return $this->connect->rename($source, $target) ? $target : false; }
CWE-918
16
protected function _renderVarInput_number($form, &$var, &$vars) { $value = $var->getValue($vars); if ($var->type->getProperty('fraction')) { $value = sprintf('%01.' . $var->type->getProperty('fraction') . 'f', $value); } $linfo = Horde_Nls::getLocaleInfo(); /* Only if there is a mon_decimal_point do the * substitution. */ if (!empty($linfo['mon_decimal_point'])) { $value = str_replace('.', $linfo['mon_decimal_point'], $value); } return sprintf('<input type="text" size="5" name="%s" id="%s" value="%s"%s />', htmlspecialchars($var->getVarName()), $this->_genID($var->getVarName(), false), $value, $this->_getActionScripts($form, $var) ); }
CWE-79
1
public static function load_object_strings($node_type, $node_id, $node_uid=null) { global $DB; $DB->query(' SELECT subtype, lang, text FROM nv_webdictionary WHERE node_type = '.protect($node_type).' AND node_id = '.protect($node_id). (empty($node_uid)? '' : ' AND ( node_uid = '.protect($node_uid).' OR node_uid = "" OR node_uid IS NULL )') );
CWE-89
0
public function save_change_password() { global $user; $isuser = ($this->params['uid'] == $user->id) ? 1 : 0; if (!$user->isAdmin() && !$isuser) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) { flash('error', gt('The current password you entered is not correct.')); expHistory::returnTo('editable'); } //eDebug($user); $u = new user($this->params['uid']); $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']); //eDebug($u, true); if (is_string($ret)) { flash('error', $ret); expHistory::returnTo('editable'); } else { $params = array(); $params['is_admin'] = !empty($u->is_admin); $params['is_acting_admin'] = !empty($u->is_acting_admin); $u->update($params); } if (!$isuser) { flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.')); } else { $user->password = $u->password; flash('message', gt('Your password has been changed.')); } expHistory::back(); }
CWE-89
0
public static function versionReport() { $v = self::latestVersion(); $html = " <div class=\"alert alert-warning\"> <span class=\"fa fa-warning\"></span> Warning: Your CMS version is different with our latest version (<strong>$v</strong>). Please upgrade your system. </div> "; return $html; }
CWE-89
0
public function getAuthority() { if (empty($this->host)) { return ''; } $authority = $this->host; if (!empty($this->userInfo)) { $authority = $this->userInfo . '@' . $authority; } if ($this->isNonStandardPort($this->scheme, $this->host, $this->port)) { $authority .= ':' . $this->port; } return $authority; }
CWE-89
0
public function testVersion() { $client = $this->getClientForAuthenticatedUser(User::ROLE_USER); $this->assertAccessIsGranted($client, '/api/version'); $result = json_decode($client->getResponse()->getContent(), true); $this->assertIsArray($result); $this->assertArrayHasKey('version', $result); $this->assertArrayHasKey('versionId', $result); $this->assertArrayHasKey('candidate', $result); $this->assertArrayHasKey('semver', $result); $this->assertArrayHasKey('name', $result); $this->assertArrayHasKey('copyright', $result); $this->assertSame(Constants::VERSION, $result['version']); $this->assertSame(Constants::VERSION_ID, $result['versionId']); $this->assertEquals(Constants::STATUS, $result['candidate']); $this->assertEquals(Constants::VERSION . '-' . Constants::STATUS, $result['semver']); $this->assertEquals(Constants::NAME, $result['name']); $this->assertEquals( 'Kimai - ' . Constants::VERSION . ' ' . Constants::STATUS . ' (' . Constants::NAME . ') by Kevin Papst and contributors.', $result['copyright'] ); }
CWE-1236
12
public static function country_region_name_by_code($code, $language="") { global $DB; // TODO: region names have no translation in database at this time // $lang = core_get_language($language); $DB->query('SELECT name FROM nv_countries_regions WHERE `numeric` = '.protect($code)); $row = $DB->first(); return $row->name; }
CWE-89
0
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 __construct () { if (self::existConf()) { # code... self::config('config'); self::lang(GX_LANG); }else{ GxMain::install(); } }
CWE-79
1
function ac_sigleid($name, $id) { global $cms_db, $sess; $sess->gc( true ); $ret = true; if( $id >= 1 ) { $ret = false; $cquery = sprintf("select count(*) from %s where user_id='%s' and name='%s'", $cms_db['sessions'], $id, $name); $squery = sprintf("select sid from %s where user_id='%s' and name='%s'", $cms_db['sessions'], $id, addslashes($name)); $this->db->query($squery); if ( $this->db->affected_rows() == 0 && $this->db->query($cquery) && $this->db->next_record() && $this->db->f(0) == 0 ) { // nothing found here $ret = true; } } return $ret; }
CWE-89
0
function GETPOST($paramname,$check='',$method=0) { if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:''); elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:''; elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:''; elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:''); if (! empty($check)) { // Check if numeric if ($check == 'int' && ! preg_match('/^[-\.,0-9]+$/i',trim($out))) $out=''; // Check if alpha //if ($check == 'alpha' && ! preg_match('/^[ =:@#\/\\\(\)\-\._a-z0-9]+$/i',trim($out))) $out=''; // '"' is dangerous because param in url can close the href= or src= and add javascript functions. if ($check == 'alpha' && preg_match('/"/',trim($out))) $out=''; } return $out; }
CWE-22
2
function MAX_adRenderImageBeacon($logUrl, $beaconId = 'beacon', $userAgent = null) { if (!isset($userAgent) && isset($_SERVER['HTTP_USER_AGENT'])) { $userAgent = $_SERVER['HTTP_USER_AGENT']; } $beaconId .= '_{random}'; // Add beacon image for logging if (isset($userAgent) && preg_match("#Mozilla/(1|2|3|4)#", $userAgent) && !preg_match("#compatible#", $userAgent)) { $div = "<layer id='{$beaconId}' width='0' height='0' border='0' visibility='hide'>"; $style = ''; $divEnd = '</layer>'; } else { $div = "<div id='{$beaconId}' style='position: absolute; left: 0px; top: 0px; visibility: hidden;'>"; $style = " style='width: 0px; height: 0px;'"; $divEnd = '</div>'; } $beacon = "$div<img src='".htmlspecialchars($logUrl)."' width='0' height='0' alt=''{$style} />{$divEnd}"; return $beacon; }
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
function getTextColumns($table) { $sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'"; $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $records = array(); while($row = mysqli_fetch_object($res)) { $records[] = $row->Field; } return $records; }
CWE-89
0
public function string($skip_ajax = false) { if ($skip_ajax == true) { $url = $this->current($skip_ajax); } else { $url = false; } $u1 = implode('/', $this->segment(-1, $url)); // clear request params $cleanParam = new HTMLClean(); $u1 = $cleanParam->cleanArray($u1); return $u1; }
CWE-79
1
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
CWE-639
9
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
CWE-89
0
public function update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { $this->flash->success(t('Swimlane updated successfully.')); return $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); } else { $errors = array('name' => array(t('Another swimlane with the same name exists in the project'))); } } return $this->edit($values, $errors); }
CWE-639
9
public function checkAuthorisation($id, $user, $write) { // fetch the bare template $template = $this->find('first', array( 'conditions' => array('id' => $id), 'recursive' => -1, )); // if not found return false if (empty($template)) { return false; } //if the user is a site admin, return the template withoug question if ($user['Role']['perm_site_admin']) { return $template; } if ($write) { // if write access is requested, check if template belongs to user's org and whether the user is authorised to edit templates if ($user['Organisation']['name'] == $template['Template']['org'] && $user['Role']['perm_template']) { return $template; } return false; } else { // if read access is requested, check if the template belongs to the user's org or alternatively whether the template is shareable if ($user['Organisation']['name'] == $template['Template']['org'] || $template['Template']['share']) { return $template; } return false; } }
CWE-79
1
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 static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-", $str); $str = str_replace("�", "&#151;", $str); $str = str_replace("�", "&rdquo;", $str); $str = str_replace("�", "&ldquo;", $str); $str = str_replace("\r\n", " ", $str); $str = str_replace("\t", " ", $str); $str = str_replace(",", "\,", $str); $str = str_replace("�", "&#188;", $str); $str = str_replace("�", "&#189;", $str); $str = str_replace("�", "&#190;", $str); if (!$isHTML) { $str = str_replace('\"', "&quot;", $str); $str = str_replace('"', "&quot;", $str); } else { $str = str_replace('"', '""', $str); } //$str = htmlspecialchars($str); //$str = utf8_encode($str); $str = trim(str_replace("�", "&trade;", $str)); //echo "2<br>"; eDebug($str,die); return $str; }
CWE-89
0
public function disable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
CWE-639
9
$arrDetail['total_price'] = sc_currency_value($cartItem->price) * $cartItem->qty; $arrCartDetail[] = $arrDetail; } //Set session info order session(['dataOrder' => $dataOrder]); session(['arrCartDetail' => $arrCartDetail]); //Create new order $newOrder = (new ShopOrder)->createOrder($dataOrder, $dataTotal, $arrCartDetail); if ($newOrder['error'] == 1) { return redirect(sc_route('cart'))->with(['error' => $newOrder['msg']]); } //Set session orderID session(['orderID' => $newOrder['orderID']]); //Create new address if ($address_process == 'new') { $addressNew = [ 'first_name' => $shippingAddress['first_name'] ?? '', 'last_name' => $shippingAddress['last_name'] ?? '', 'first_name_kana' => $shippingAddress['first_name_kana'] ?? '', 'last_name_kana' => $shippingAddress['last_name_kana'] ?? '', 'postcode' => $shippingAddress['postcode'] ?? '', 'address1' => $shippingAddress['address1'] ?? '', 'address2' => $shippingAddress['address2'] ?? '', 'country' => $shippingAddress['country'] ?? '', 'phone' => $shippingAddress['phone'] ?? '', ]; ShopCustomer::find($uID)->addresses()->save(new ShopCustomerAddress(sc_clean($addressNew))); session()->forget('address_process'); //destroy address_process } $paymentMethod = sc_get_class_plugin_controller('Payment', session('paymentMethod')); if ($paymentMethod) { // Check payment method return (new $paymentMethod)->processOrder(); } else { return (new ShopCartController)->completeOrder(); } }
CWE-79
1
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,null,null,$maxwidth); // since most likely this function will only get hit via flash in YUI Uploader // and since Flash can't pass cookies, we lose the knowledge of our $user // so we're passing the user's ID in as $_POST data. We then instantiate a new $user, // and then assign $user->id to $file->poster so we have an audit trail for the upload if (is_object($file)) { $resized = !empty($file->resized) ? true : false; $user = new user($this->params['usrid']); $file->poster = $user->id; $file->posted = $file->last_accessed = time(); $file->save(); if (!empty($this->params['cat'])) { $expcat = new expCat($this->params['cat']); $params['expCat'][0] = $expcat->id; $file->update($params); } // a echo so YUI Uploader is notified of the function's completion if ($resized) { echo gt('File resized and then saved'); } else { echo gt('File saved'); } } else { echo gt('File was NOT uploaded!'); // flash('error',gt('File was not uploaded!')); } }
CWE-89
0
public function get($key, $default = null, $deep = false) { if ($deep) { @trigger_error('Using paths to find deeper items in '.__METHOD__.' is deprecated since version 2.8 and will be removed in 3.0. Filter the returned value in your own code instead.', E_USER_DEPRECATED); } if (!$deep || false === $pos = strpos($key, '[')) { return array_key_exists($key, $this->parameters) ? $this->parameters[$key] : $default; } $root = substr($key, 0, $pos); if (!array_key_exists($root, $this->parameters)) { return $default; } $value = $this->parameters[$root]; $currentKey = null; for ($i = $pos, $c = strlen($key); $i < $c; ++$i) { $char = $key[$i]; if ('[' === $char) { if (null !== $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "[" at position %d.', $i)); } $currentKey = ''; } elseif (']' === $char) { if (null === $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i)); } if (!is_array($value) || !array_key_exists($currentKey, $value)) { return $default; } $value = $value[$currentKey]; $currentKey = null; } else { if (null === $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "%s" at position %d.', $char, $i)); } $currentKey .= $char; } } if (null !== $currentKey) { throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); } return $value; }
CWE-89
0
public function getTestData() { return [ [[], 'Kimai - ' . Constants::VERSION . ' ' . Constants::STATUS . ' (' . Constants::NAME . ') by Kevin Papst and contributors.'], [['--name' => true], Constants::NAME], [['--candidate' => true], Constants::STATUS], [['--short' => true], Constants::VERSION], [['--semver' => true], Constants::VERSION . '-' . Constants::STATUS], ]; }
CWE-1236
12
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 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
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
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
CWE-639
9
protected function _copy($source, $targetDir, $name) { $res = false; if ($this->tmp) { $local = $this->getTempFile(); $target = $this->_joinPath($targetDir, $name); if (ftp_get($this->connect, $local, $source, FTP_BINARY) && ftp_put($this->connect, $target, $local, $this->ftpMode($target))) { $res = $target; } @unlink($local); } return $res; }
CWE-89
0
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
CWE-639
9
public function manage() { expHistory::set('manageable', $this->params); // build out a SQL query that gets all the data we need and is sortable. $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id '; $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f '; $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type="banner")'; $page = new expPaginator(array( 'model'=>'banner', 'sql'=>$sql, 'order'=>'title', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title', gt('Company')=>'companyname', gt('Impressions')=>'impressions', gt('Clicks')=>'clicks' ) )); assign_to_template(array( 'page'=>$page )); }
CWE-89
0
protected function parseChunkedRequest(Request $request) { $totalChunkCount = $request->get('dztotalchunkcount'); $index = $request->get('dzchunkindex'); $last = ((int) $index + 1) === (int) $totalChunkCount; $uuid = $request->get('dzuuid'); /** * @var UploadedFile */ $file = $request->files->get('file')->getClientOriginalName(); $orig = $file; return [$last, $uuid, $index, $orig]; }
CWE-22
2
public function testConstructor() { $dompdf = new Dompdf(); $this->assertInstanceOf(CPDF::class, $dompdf->getCanvas()); $this->assertSame("", $dompdf->getProtocol()); $this->assertSame("", $dompdf->getBaseHost()); $this->assertSame("", $dompdf->getBasePath()); $this->assertIsArray($dompdf->getCallbacks()); $this->assertInstanceOf(Stylesheet::class, $dompdf->getCss()); $this->assertNull($dompdf->getDom()); $this->assertNull($dompdf->getHttpContext()); $this->assertInstanceOf(Options::class, $dompdf->getOptions()); $this->assertFalse($dompdf->getQuirksmode()); $this->assertNull($dompdf->getTree()); }
CWE-918
16
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
protected function _filePutContents($path, $content) { return $this->query(sprintf('UPDATE %s SET content="%s", size=%d, mtime=%d WHERE id=%d LIMIT 1', $this->tbf, $this->db->real_escape_string($content), strlen($content), time(), $path)); }
CWE-89
0
$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 afterSave($event) { // look up current tags $oldTags = $this->getTags(); $newTags = array(); foreach ($this->scanForTags() as $tag) { if (!in_array($tag, $oldTags)) { // don't add duplicates if there are already tags $tagModel = new Tags; $tagModel->tag = $tag; // includes the # $tagModel->type = get_class($this->getOwner()); $tagModel->itemId = $this->getOwner()->id; $tagModel->itemName = $this->getOwner()->name; $tagModel->taggedBy = Yii::app()->getSuName(); $tagModel->timestamp = time(); if ($tagModel->save()) $newTags[] = $tag; } } $this->_tags = $newTags + $oldTags; // update tag cache if (!empty($newTags) && $this->flowTriggersEnabled) { X2Flow::trigger('RecordTagAddTrigger', array( 'model' => $this->getOwner(), 'tags' => $newTags, )); } }
CWE-79
1
foreach ($day as $extevent) { $event_cache = new stdClass(); $event_cache->feed = $extgcalurl; $event_cache->event_id = $extevent->event_id; $event_cache->title = $extevent->title; $event_cache->body = $extevent->body; $event_cache->eventdate = $extevent->eventdate->date; if (isset($extevent->dateFinished) && $extevent->dateFinished != -68400) $event_cache->dateFinished = $extevent->dateFinished; if (isset($extevent->eventstart)) $event_cache->eventstart = $extevent->eventstart; if (isset($extevent->eventend)) $event_cache->eventend = $extevent->eventend; if (isset($extevent->is_allday)) $event_cache->is_allday = $extevent->is_allday; $found = false; if ($extevent->eventdate->date < $start) // prevent duplicating events crossing month boundaries $found = $db->selectObject('event_cache','feed="'.$extgcalurl.'" AND event_id="'.$event_cache->event_id.'" AND eventdate='.$event_cache->eventdate); if (!$found) $db->insertObject($event_cache,'event_cache'); }
CWE-89
0
public function rename(){ if($this->request->isMethod('POST')){ $new_file = $this->request->input('new_file'); if(!\Security::isExecutable($new_file) && \Storage::move($this->request->input('old_file'), $new_file)){ if($this->request->ajax()){ return response()->json(['success' => trans('File successfully renamed!')]); } }else{ if($this->request->ajax()){ return response()->json(['danger' => trans('message.something_went_wrong')]); } } } }
CWE-434
5
public function __construct () { global $vars; if(DB_DRIVER == 'mysql') { mysql_connect(DB_HOST, DB_USER, DB_PASS); mysql_select_db(DB_NAME); }elseif(DB_DRIVER == 'mysqli') { try { self::$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); if (self::$mysqli->connect_error) { Control::error('db', self::$mysqli->connect_error); exit; }else{ return true; } } catch (exception $e) { Control::error('db', $e->getMessage() ); } //return self::$mysqli; } }
CWE-89
0
public static function theme($var, $data='') { if (isset($data)) { # code... $GLOBALS['data'] = $data; } if (self::exist($var)) { include(GX_THEME.THEME.'/'.$var.'.php'); }else{ Control::error('unknown','Theme file is missing.'); } }
CWE-89
0
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webdictionary WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); return $out; }
CWE-89
0
public function __construct(){ }
CWE-79
1
function clone(array $override_input = [], bool $history = true) { global $DB, $CFG_GLPI; if ($DB->isSlave()) { return false; } $new_item = new static(); $input = $this->fields; foreach ($override_input as $key => $value) { $input[$key] = $value; } $input = $new_item->prepareInputForClone($input); if (isset($input['id'])) { $input['_oldID'] = $input['id']; unset($input['id']); } unset($input['date_creation']); unset($input['date_mod']); if (isset($input['template_name'])) { unset($input['template_name']); } if (isset($input['is_template'])) { unset($input['is_template']); } $input['clone'] = true; $newID = $new_item->add($input, [], $history); // If the item needs post clone (recursive cloning for example) $new_item->post_clone($this, $history); return $newID; }
CWE-89
0
public function getQuerySelect() { $R2 = 'R2_' . $this->id; return "$R2.value AS `" . $this->name . "`"; }
CWE-89
0
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
public function getQuerySelect() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; $R3 = 'R3_' . $this->field->id; return "$R2.id AS `" . $this->field->name . "`"; }
CWE-89
0
public static function calculate_object_score($object, $object_id) { global $DB; global $website; $DB->query('SELECT COUNT(*) as votes, SUM(value) as score FROM nv_webuser_votes WHERE object_id = '.protect($object_id).' AND object = '.protect($object).' AND website = '.$website->id); $data = $DB->first(); return array($data->votes, $data->score); }
CWE-89
0
public function beforeFilter() { parent::beforeFilter(); $this->Security->unlockedActions = array_merge($this->Security->unlockedActions, array('setHomePage')); }
CWE-79
1
public function search_external() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "external_addresses as a "; //R JOIN " . //$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id "; $sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) "; $sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) ASC LIMIT 12"; $res = $db->selectObjectsBySql($sql); foreach ($res as $key=>$record) { $res[$key]->title = $record->firstname . ' ' . $record->lastname; } //eDebug($sql); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
CWE-89
0
$link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr ); } else { $link_text = ''; } if ( trim( $link_text ) == '' ) $link_text = $_post->post_title; /** * Filters a retrieved attachment page link. * * @since 2.7.0 * * @param string $link_html The page link HTML output. * @param int $id Post ID. * @param string|array $size Size of the image. Image size or array of width and height values (in that order). * Default 'thumbnail'. * @param bool $permalink Whether to add permalink to image. Default false. * @param bool $icon Whether to include an icon. Default false. * @param string|bool $text If string, will be link text. Default false. */ return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text ); }
CWE-79
1
public static function getLatestVersion ($now) { $v = file_get_contents("https://raw.githubusercontent.com/semplon/GeniXCMS/master/VERSION"); $arr = array( 'version' => trim($v), 'last_check' => $now ); $arr = json_encode($arr); Options::update('system_check', $arr); return $v; }
CWE-89
0
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.m4a','.ogg','.webma','.mp4','.flv', '.mov','.webmv','.m3u8a','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso','.bz2','.epub', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.odt','.rtf','.docm','.dotm','.dot','.dotx','.wps','.wpt', '.ppt','.pptx','.xls','.xlsx','.txt','.md','.psd','.csv', '.cer','.ppt','.pub','.properties','.json','.css', ) ; $ext = strtolower(substr($filename,strripos($filename,'.')) ); //获取文件扩展名(转为小写后) if(in_array( $ext , $allow_array ) ){ return true ; } return false; }
CWE-79
1
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.mp4', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.wps', '.ppt','.pptx','.xls','.xlsx','.txt','.psd','.csv', '.cer','.ppt','.pub','.json','.css', ) ; $ext = strtolower(substr($filename,strripos($filename,'.')) ); //获取文件扩展名(转为小写后) if(in_array( $ext , $allow_array ) ){ return true ; } return false; }
CWE-79
1
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ;
CWE-502
15