code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
static function isSearchable() { return true; }
CWE-89
0
public function verifyDOMDocument($document) { $signatureNode = $this->locateSignature($document); /** * No signature was added, it should not fail as this is not a requirement on redirect bindings */ if (!$signatureNode) { return true; } $this->add509Cert($this->getCertificate()->getPublicKey()->getX509Certificate()); $this->setCanonicalMethod(XMLSecurityDSig::EXC_C14N); $this->addReference($document->documentElement, XMLSecurityDSig::SHA1, array('http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N), array('id_name' => 'ID')); return $this->verify($this->getCertificate()->getPublicKey()); }
CWE-347
25
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
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); break; } // Error code for both. if ($connection === false) { switch ($DatabaseType) { case 'mysqli': $errormessage = mysqli_error($connection); break; } db_show_error("", "" . _couldNotConnectToDatabase . ": $DatabaseServer", $errormessage); } return $connection; }
CWE-22
2
public static function DragnDropReRank2() { global $router, $db; $id = $router->params['id']; $page = new section($id); $old_rank = $page->rank; $old_parent = $page->parent; $new_rank = $router->params['position'] + 1; // rank $new_parent = intval($router->params['parent']); $db->decrement($page->tablename, 'rank', 1, 'rank>' . $old_rank . ' AND parent=' . $old_parent); // close in hole $db->increment($page->tablename, 'rank', 1, 'rank>=' . $new_rank . ' AND parent=' . $new_parent); // make room $params = array(); $params['parent'] = $new_parent; $params['rank'] = $new_rank; $page->update($params); self::checkForSectionalAdmins($id); expSession::clearAllUsersSessionCache('navigation'); }
CWE-89
0
function scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); } return $ret; }
CWE-89
0
public static function withoutQueryValue(UriInterface $uri, $key) { $current = $uri->getQuery(); if (!$current) { return $uri; } $result = []; foreach (explode('&', $current) as $part) { if (explode('=', $part)[0] !== $key) { $result[] = $part; }; } return $uri->withQuery(implode('&', $result)); }
CWE-89
0
public static function get_param($key = NULL) { $info = [ 'stype' => htmlentities(self::$search_type), 'stext' => htmlentities(self::$search_text), 'method' => htmlentities(self::$search_method), 'datelimit' => self::$search_date_limit, 'fields' => self::$search_fields, 'sort' => self::$search_sort, 'chars' => htmlentities(self::$search_chars), 'order' => self::$search_order, 'forum_id' => self::$forum_id, 'memory_limit' => self::$memory_limit, 'composevars' => self::$composevars, 'rowstart' => self::$rowstart, 'search_param' => self::$search_param, ]; return $key === NULL ? $info : (isset($info[$key]) ? $info[$key] : NULL); }
CWE-79
1
function teampass_whitelist() { $bdd = teampass_connect(); $apiip_pool = teampass_get_ips(); if (count($apiip_pool) > 0 && !array_search($_SERVER['REMOTE_ADDR'], $apiip_pool)) { rest_error('IPWHITELIST'); } }
CWE-79
1
$conditions[] = sprintf("\$this->has('%s')", $service); } if (!$conditions) { return ''; } return implode(' && ', $conditions); }
CWE-89
0
protected function __construct() { parent::__construct(); self::$locale = fusion_get_locale('', LOCALE.LOCALESET.'search.php'); }
CWE-79
1
function update_optiongroup_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $og = new optiongroup_master($id); $oldtitle = $og->title; $og->update($this->params); // if the title of the master changed we should update the option groups that are already using it. if ($oldtitle != $og->title) { $db->sql('UPDATE '.$db->prefix.'optiongroup SET title="'.$og->title.'" WHERE title="'.$oldtitle.'"'); } expHistory::back(); }
CWE-89
0
function update_option_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $opt = new option_master($id); $oldtitle = $opt->title; $opt->update($this->params); // if the title of the master changed we should update the option groups that are already using it. if ($oldtitle != $opt->title) { }$db->sql('UPDATE '.$db->prefix.'option SET title="'.$opt->title.'" WHERE option_master_id='.$opt->id); expHistory::back(); }
CWE-89
0
foreach ($days as $event) { if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break; if (empty($event->eventstart)) $event->eventstart = $event->eventdate->date; $extitem[] = $event; }
CWE-89
0
static function description() { return "Manage events and schedules, and optionally publish them."; }
CWE-89
0
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
CWE-22
2
$_fn[] = self::buildCondition($v, ' && '); } $fn[] = '('.\implode(' || ', $_fn).')'; break; case '$where': if (\is_callable($value)) { // need implementation } break; default: $d = '$document'; if (\strpos($key, '.') !== false) { $keys = \explode('.', $key); foreach ($keys as $k) { $d .= '[\''.$k.'\']'; } } else { $d .= '[\''.$key.'\']'; } if (\is_array($value)) { $fn[] = "\\MongoLite\\UtilArrayQuery::check((isset({$d}) ? {$d} : null), ".\var_export($value, true).')'; } else { if (is_null($value)) { $fn[] = "(!isset({$d}))"; } else { $_value = \var_export($value, true); $fn[] = "(isset({$d}) && ( is_array({$d}) && is_string({$_value}) ? in_array({$_value}, {$d}) : {$d}=={$_value} ) )"; } } } } return \count($fn) ? \trim(\implode($concat, $fn)) : 'true'; }
CWE-89
0
} elseif (isset($graph['data_query_name'])) { if (isset($prev_data_query_name)) { if ($prev_data_query_name != $graph['data_query_name']) { $print = true; $prev_data_query_name = $graph['data_query_name']; } else { $print = false; } } else { $print = true; $prev_data_query_name = $graph['data_query_name']; } if ($print) { if (!$start) { while(($i % $columns) != 0) { print "<td style='text-align:center;width:" . round(100 / $columns, 3) . "%;'></td>"; $i++; } print "</tr>\n"; } print "<tr class='tableHeader'> <td class='graphSubHeaderColumn textHeaderDark' colspan='$columns'>" . __('Data Query:') . ' ' . $graph['data_query_name'] . "</td> </tr>\n"; $i = 0; } } if ($i == 0) { print "<tr class='tableRowGraph'>\n"; $start = false; } ?> <td style='width:<?php print round(100 / $columns, 2);?>%;'> <table style='text-align:center;margin:auto;'> <tr> <td> <div class='graphWrapper' id='wrapper_<?php print $graph['local_graph_id']?>' graph_width='<?php print read_user_setting('default_width');?>' graph_height='<?php print read_user_setting('default_height');?>'></div> <?php print (read_user_setting('show_graph_title') == 'on' ? "<span class='center'>" . htmlspecialchars($graph['title_cache']) . '</span>' : '');?> </td> <td id='dd<?php print $graph['local_graph_id'];?>' class='noprint graphDrillDown'> <?php print graph_drilldown_icons($graph['local_graph_id'], 'graph_buttons_thumbnails');?> </td> </tr> </table> </td> <?php $i++; $k++; if (($i % $columns) == 0 && ($k < $num_graphs)) { $i=0; $j++; print "</tr>\n"; $start = true; } } if (!$start) { while(($i % $columns) != 0) { print "<td style='text-align:center;width:" . round(100 / $columns, 2) . "%;'></td>"; $i++; } print "</tr>\n"; } } else {
CWE-79
1
public function __construct($page, $file = null) { $this->page = $page; $this->file = $file; $this->blueprint = $page->blueprint(); $this->filename = $this->blueprint->files()->sanitize() ? '{safeFilename}' : '{filename}'; if($this->file) { $this->replace(); } else { $this->upload(); } }
CWE-434
5
function VerifyVariableSchedule_Update($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:''); // $all_teacher=$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
$chrootPath = realpath($chrootPath); if ($chrootPath !== false && strpos($realfile, $chrootPath) === 0) { $chrootValid = true; break; } } if ($chrootValid !== true) { Helpers::record_warnings(E_USER_WARNING, "Permission denied on $file. The file could not be found under the paths specified by Options::chroot.", __FILE__, __LINE__); return; } } if (!$realfile) { Helpers::record_warnings(E_USER_WARNING, "File '$realfile' not found.", __FILE__, __LINE__); return; } $file = $realfile; } [$css, $http_response_header] = Helpers::getFileContent($file, $this->_dompdf->getHttpContext()); $good_mime_type = true; // See http://the-stickman.com/web-development/php/getting-http-response-headers-when-using-file_get_contents/ if (isset($http_response_header) && !$this->_dompdf->getQuirksmode()) { foreach ($http_response_header as $_header) { if (preg_match("@Content-Type:\s*([\w/]+)@i", $_header, $matches) && ($matches[1] !== "text/css") ) { $good_mime_type = false; } } } if (!$good_mime_type || $css === null) { Helpers::record_warnings(E_USER_WARNING, "Unable to load css file $file", __FILE__, __LINE__); return; } } $this->_parse_css($css); }
CWE-73
23
public function save() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { if ($this->categoryModel->create($values) !== false) { $this->flash->success(t('Your category have been created successfully.')); $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true); return; } else { $errors = array('name' => array(t('Another category with the same name exists in this project'))); } } $this->create($values, $errors); }
CWE-639
9
function edit_optiongroup_master() { expHistory::set('editable', $this->params); $id = isset($this->params['id']) ? $this->params['id'] : null; $record = new optiongroup_master($id); assign_to_template(array( 'record'=>$record )); }
CWE-89
0
public function checkLdapLogin(){ $username = 'admin'; $password = '123456'; $ldap_open = D("Options")->get("ldap_open" ) ; $ldap_form = D("Options")->get("ldap_form" ) ; $ldap_form = json_decode($ldap_form,1); if (!$ldap_open) { return ; } if (!$ldap_form['user_field']) { $ldap_form['user_field'] = 'cn'; } $ldap_conn = ldap_connect($ldap_form['host'], $ldap_form['port']);//建立与 LDAP 服务器的连接 if (!$ldap_conn) { $this->sendError(10011,"Can't connect to LDAP server"); return ; } ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, $ldap_form['version']); $rs=ldap_bind($ldap_conn, $ldap_form['bind_dn'], $ldap_form['bind_password']);//与服务器绑定 用户登录验证 成功返回1 if (!$rs) { $this->sendError(10011,"Can't bind to LDAP server"); return ; } $result = ldap_search($ldap_conn,$ldap_form['base_dn'],"(cn=*)"); $data = ldap_get_entries($ldap_conn, $result); for ($i=0; $i<$data["count"]; $i++) { $ldap_user = $data[$i][$ldap_form['user_field']][0] ; $dn = $data[$i]["dn"] ; if ($ldap_user == $username) { //如果该用户不在数据库里,则帮助其注册 $userInfo = D("User")->isExist($username) ; if(!$userInfo){ D("User")->register($ldap_user,$ldap_user.time()); } $rs2=ldap_bind($ldap_conn, $dn , $password); if ($rs2) { D("User")->updatePwd($userInfo['uid'], $password); $this->sendResult(array()); return ; } } } $this->sendError(10011,"用户名或者密码错误"); }
CWE-338
21
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
public function __construct($site) { // If the REST API Proxy Plugin isn't active, always use the current site. if(! PMB_REST_PROXY_EXISTS){ $site = ''; } $this->setSite($site); $this->getSiteInfo(); }
CWE-918
16
function send_feedback() { $success = false; if (isset($this->params['id'])) { $ed = new eventdate($this->params['id']); // $email_addrs = array(); if ($ed->event->feedback_email != '') { $msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . $this->params['formname'], $this->loc); $msgtemplate->assign('params', $this->params); $msgtemplate->assign('event', $ed); $email_addrs = explode(',', $ed->event->feedback_email); //This is an easy way to remove duplicates $email_addrs = array_flip(array_flip($email_addrs)); $email_addrs = array_map('trim', $email_addrs); $mail = new expMail(); $success += $mail->quickSend(array( "text_message" => $msgtemplate->render(), 'to' => $email_addrs, 'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS), 'subject' => $this->params['subject'], )); } } if ($success) { flashAndFlow('message', gt('Your feedback was successfully sent.')); } else { flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.')); } }
CWE-89
0
public function confirm() { $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, 'filter' => $filter, 'title' => t('Remove a custom filter') ))); }
CWE-639
9
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
private function configureDefaults(array $config) { $defaults = [ 'allow_redirects' => RedirectMiddleware::$defaultSettings, 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false ]; // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set if ($proxy = getenv('HTTP_PROXY')) { $defaults['proxy']['http'] = $proxy; } if ($proxy = getenv('HTTPS_PROXY')) { $defaults['proxy']['https'] = $proxy; } if ($noProxy = getenv('NO_PROXY')) { $cleanedNoProxy = str_replace(' ', '', $noProxy); $defaults['proxy']['no'] = explode(',', $cleanedNoProxy); } $this->config = $config + $defaults; if (!empty($config['cookies']) && $config['cookies'] === true) { $this->config['cookies'] = new CookieJar(); } // Add the default user-agent header. if (!isset($this->config['headers'])) { $this->config['headers'] = ['User-Agent' => default_user_agent()]; } else { // Add the User-Agent header if one was not already set. foreach (array_keys($this->config['headers']) as $name) { if (strtolower($name) === 'user-agent') { return; } } $this->config['headers']['User-Agent'] = default_user_agent(); } }
CWE-89
0
protected function getTempFile($path = '') { static $cache = array(); static $rmfunc; $key = ''; if ($path !== '') { $key = $this->id . '#' . $path; if (isset($cache[$key])) { return $cache[$key]; } } if ($tmpdir = $this->getTempPath()) { if (!$rmfunc) { $rmfunc = create_function('$f', 'is_file($f) && @unlink($f);'); } $name = tempnam($tmpdir, 'ELF'); if ($key) { $cache[$key] = $name; } register_shutdown_function($rmfunc, $name); return $name; } return false; }
CWE-89
0
function get(&$dbh, $proposalId, $handle) { $sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS timestamp FROM package_proposal_votes WHERE pkg_prop_id = ". $dbh->quoteSmart($proposalId) ." AND user_handle= ". $dbh->quoteSmart($handle); $res = $dbh->query($sql); if (DB::isError($res)) { return $res; } if (!$res->numRows()) { return null; } $set = $res->fetchRow(DB_FETCHMODE_ASSOC); $set['reviews'] = unserialize($set['reviews']); $vote = new ppVote($set); return $vote; }
CWE-502
15
public function load_from_resultset($rs) { global $DB; $main = $rs[0]; $this->id = $main->id; $this->codename = $main->codename; $this->icon = $main->icon; $this->lid = $main->lid; $this->notes = $main->notes; $this->enabled = $main->enabled; /* $DB->query('SELECT function_id FROM nv_menu_items WHERE menu_id = '.$this->id.' ORDER BY position ASC'); $this->functions = $DB->result('function_id'); */ $this->functions = json_decode($main->functions); if(empty($this->functions)) $this->functions = array(); }
CWE-79
1
$files[$i] = '.' . DIRECTORY_SEPARATOR . basename($file); } $files = array_map('escapeshellarg', $files); $cmd = $arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . implode(' ', $files); $err_out = ''; $this->procExec($cmd, $o, $c, $err_out, $dir); chdir($cwd); } else { return false; } } $path = $dir . DIRECTORY_SEPARATOR . $name; return file_exists($path) ? $path : false; }
CWE-22
2
form_selectable_cell(filter_value($vdef['name'], get_request_var('filter'), 'vdef.php?action=edit&id=' . $vdef['id']), $vdef['id']); form_selectable_cell($disabled ? __('No'):__('Yes'), $vdef['id'], '', 'text-align:right'); form_selectable_cell(number_format_i18n($vdef['graphs'], '-1'), $vdef['id'], '', 'text-align:right'); form_selectable_cell(number_format_i18n($vdef['templates'], '-1'), $vdef['id'], '', 'text-align:right'); form_checkbox_cell($vdef['name'], $vdef['id'], $disabled); form_end_row(); }
CWE-79
1
public function getDisplayName ($plural=true) { return Yii::t('workflow', '{process}', array( '{process}' => Modules::displayName($plural, 'Process'), )); }
CWE-79
1
(empty($object_uid)? '' : ' AND node_uid = '.protect($object_uid)).' AND website = '.$website->id );
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 remove($zdb) { $id = (int)$this->id; if ($id === self::MR || $id === self::MRS) { throw new \RuntimeException(_T("You cannot delete Mr. or Mrs. titles!")); } try { $delete = $zdb->delete(self::TABLE); $delete->where( self::PK . ' = ' . $id ); $zdb->execute($delete); Analog::log( 'Title #' . $id . ' (' . $this->short . ') deleted successfully.', Analog::INFO ); return true; } catch (\RuntimeException $re) { throw $re; } catch (Throwable $e) { Analog::log( 'Unable to delete title ' . $id . ' | ' . $e->getMessage(), Analog::ERROR ); throw $e; } }
CWE-89
0
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('orders_status.php', 'page=' . $_GET['page']), null, null, 'btn-light')];
CWE-79
1
public static function sitemap() { switch (SMART_URL) { case true: # code... $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":""; $url = Site::$url.$inFold."/sitemap".GX_URL_PREFIX; break; default: # code... $url = Site::$url."/index.php?page=sitemap"; break; } return $url; }
CWE-89
0
public function twoFactorAuthenticationAction(Request $request) { $view = $this->buildLoginPageViewModel(); if ($request->hasSession()) { $session = $request->getSession(); $authException = $session->get(Security::AUTHENTICATION_ERROR); if ($authException instanceof AuthenticationException) { $session->remove(Security::AUTHENTICATION_ERROR); $view->error = $authException->getMessage(); } } else { $view->error = 'No session available, it either timed out or cookies are not enabled.'; } return $view; }
CWE-307
26
public function display_sdm_thumbnail_meta_box($post) { // Thumbnail upload metabox $old_thumbnail = get_post_meta($post->ID, 'sdm_upload_thumbnail', true); $old_value = isset($old_thumbnail) ? $old_thumbnail : ''; _e('Manually enter a valid URL, or click "Select Image" to upload (or choose) the file thumbnail image.', 'simple-download-monitor'); ?> <br /><br /> <input id="sdm_upload_thumbnail" type="text" size="100" name="sdm_upload_thumbnail" value="<?php echo $old_value; ?>" placeholder="http://..." /> <br /><br /> <input id="upload_thumbnail_button" type="button" class="button-primary" value="<?php _e('Select Image', 'simple-download-monitor'); ?>" /> <input id="remove_thumbnail_button" type="button" class="button" value="<?php _e('Remove Image', 'simple-download-monitor'); ?>" /> <br /><br /> <span id="sdm_admin_thumb_preview"> <?php if (!empty($old_value)) { ?><img id="sdm_thumbnail_image" src="<?php echo $old_value; ?>" style="max-width:200px;" /> <?php } ?> </span> <?php echo '<p class="description">'; _e('This thumbnail image will be used to create a fancy file download box if you want to use it.', 'simple-download-monitor'); echo '</p>'; wp_nonce_field('sdm_thumbnail_box_nonce', 'sdm_thumbnail_box_nonce_check'); }
CWE-79
1
public function testAllowsFalseyUrlParts() { $url = new Uri('http://a:1/0?0#0'); $this->assertSame('a', $url->getHost()); $this->assertEquals(1, $url->getPort()); $this->assertSame('/0', $url->getPath()); $this->assertEquals('0', (string) $url->getQuery()); $this->assertSame('0', $url->getFragment()); $this->assertEquals('http://a:1/0?0#0', (string) $url); $url = new Uri(''); $this->assertSame('', (string) $url); $url = new Uri('0'); $this->assertSame('0', (string) $url); $url = new Uri('/'); $this->assertSame('/', (string) $url); }
CWE-89
0
recyclebin::sendToRecycleBin($loc, $parent); //FIXME if we delete the module & sectionref the module completely disappears // if (class_exists($secref->module)) { // $modclass = $secref->module; // //FIXME: more module/controller glue code // if (expModules::controllerExists($modclass)) { // $modclass = expModules::getControllerClassName($modclass); // $mod = new $modclass($loc->src); // $mod->delete_instance(); // } else { // $mod = new $modclass(); // $mod->deleteIn($loc); // } // } } // $db->delete('sectionref', 'section=' . $parent); $db->delete('section', 'parent=' . $parent); }
CWE-89
0
public static function isEnable() { if (Options::v('google_captcha_enable') === 'on') { return true; }else{ return false; } }
CWE-89
0
public static function vulnerableExtensions(){ return '/^.*\.('.implode('|',["php","php5","php7","phar","phtml"]).')$/i'; }
CWE-434
5
$v = trim($v); } } // Remove the header lines. foreach (array_keys($new->headerLines) as $key) { if (strtolower($key) === $name) { unset($new->headerLines[$key]); } } // Add the header line. $new->headerLines[$header] = $new->headers[$name]; return $new; }
CWE-89
0
public function update() { global $DB; $ok = $DB->execute(' UPDATE nv_menus SET codename = :codename, icon = :icon, lid = :lid, notes = :notes, functions = :functions, enabled = :enabled WHERE id = :id', array( 'id' => $this->id, 'codename' => value_or_default($this->codename, ""), 'icon' => value_or_default($this->icon, ""), 'lid' => value_or_default($this->lid, 0), 'notes' => value_or_default($this->notes, ""), 'functions' => json_encode($this->functions), 'enabled' => value_or_default($this->enabled, 0) ) ); if(!$ok) throw new Exception($DB->get_last_error()); return true; }
CWE-79
1
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
public static function checkPermissions($permission,$location) { global $exponent_permissions_r, $router; // only applies to the 'manage' method if (empty($location->src) && empty($location->int) && (!empty($router->params['action']) && $router->params['action'] == 'manage') || strpos($router->current_url, 'action=manage') !== false) { if (!empty($exponent_permissions_r['navigation'])) foreach ($exponent_permissions_r['navigation'] as $page) { foreach ($page as $pageperm) { if (!empty($pageperm['manage'])) return true; } } } return false; }
CWE-89
0
public function ExpandHash($project, $abbrevHash) { if (!$project) return $abbrevHash; if (!(preg_match('/[0-9A-Fa-f]{4,39}/', $abbrevHash))) { return $abbrevHash; } $args = array(); $args[] = '-1'; $args[] = '--format=format:%H'; $args[] = $abbrevHash; $fullData = explode("\n", $this->exe->Execute($project->GetPath(), GIT_REV_LIST, $args)); if (empty($fullData[0])) { return $abbrevHash; } if (substr_compare(trim($fullData[0]), 'commit', 0, 6) !== 0) { return $abbrevHash; } if (empty($fullData[1])) { return $abbrevHash; } return trim($fullData[1]); }
CWE-78
6
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
private function createResponse( RequestInterface $request, array $options, $stream, $startTime ) { $hdrs = $this->lastHeaders; $this->lastHeaders = []; $parts = explode(' ', array_shift($hdrs), 3); $ver = explode('/', $parts[0])[1]; $status = $parts[1]; $reason = isset($parts[2]) ? $parts[2] : null; $headers = \GuzzleHttp\headers_from_lines($hdrs); list ($stream, $headers) = $this->checkDecode($options, $headers, $stream); $stream = Psr7\stream_for($stream); $sink = $this->createSink($stream, $options); $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); if (isset($options['on_headers'])) { try { $options['on_headers']($response); } catch (\Exception $e) { $msg = 'An error was encountered during the on_headers event'; $ex = new RequestException($msg, $request, $response, $e); return new RejectedPromise($ex); } } if ($sink !== $stream) { $this->drain($stream, $sink); } $this->invokeStats($options, $request, $startTime, $response, null); return new FulfilledPromise($response); }
CWE-89
0
private function formatMessage($message) { if ($this->timezone) { $graylogTime = new DateTime($message['message']['timestamp']); $offset = $this->timezone->getOffset($graylogTime); $timeInterval = DateInterval::createFromDateString((string) $offset . 'seconds'); $graylogTime->add($timeInterval); $displayTime = $graylogTime->format('Y-m-d H:i:s'); } else { $displayTime = $message['message']['timestamp']; } $device = $this->deviceFromSource($message['message']['source']); $level = $message['message']['level'] ?? ''; $facility = $message['message']['facility'] ?? ''; return [ 'severity' => $this->severityLabel($level), 'timestamp' => $displayTime, 'source' => $device ? Url::deviceLink($device) : $message['message']['source'], 'message' => $message['message']['message'] ?? '', 'facility' => is_numeric($facility) ? "($facility) " . __("syslog.facility.$facility") : $facility, 'level' => (is_numeric($level) && $level >= 0) ? "($level) " . __("syslog.severity.$level") : $level, ]; }
CWE-79
1
protected function getC1Service() { return $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\includes\HotPath\C1(); }
CWE-89
0
protected function _copy($source, $targetDir, $name) { $res = false; $target = $this->_joinPath($targetDir, $name); if ($this->tmp) { $local = $this->getTempFile(); if ($this->connect->get($source, $local) && $this->connect->put($target, $local, NET_SFTP_LOCAL_FILE)) { $res = true; } unlink($local); } else { //not memory efficient $res = $this->_filePutContents($target, $this->_getContents($source)); } return $res; }
CWE-78
6
public function getViewItemLink($icmsObj, $onlyUrl=false, $withimage=true, $userSide=false) { if ($this->handler->_moduleName != 'system') { $admin_side = $userSide ? '' : 'admin/'; $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . "?" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName); } else { $admin_side = ''; $ret = $this->handler->_moduleUrl . $admin_side . 'admin.php?fct=' . $this->handler->_itemname . "&amp;op=view&amp;" . $this->handler->keyName . "=" . $icmsObj->getVar($this->handler->keyName); } if ($onlyUrl) { return $ret; } elseif ($withimage) { return "<a href='" . $ret . "'> <img src='" . ICMS_IMAGES_SET_URL . "/actions/viewmag.png' style='vertical-align: middle;' alt='" . _PREVIEW . "' title='" . _PREVIEW . "'/></a>"; } return "<a href='" . $ret . "'>" . $icmsObj->getVar($this->handler->identifierName) . "</a>"; }
CWE-22
2
public static function DragnDropReRank2() { global $router, $db; $id = $router->params['id']; $page = new section($id); $old_rank = $page->rank; $old_parent = $page->parent; $new_rank = $router->params['position'] + 1; // rank $new_parent = intval($router->params['parent']); $db->decrement($page->tablename, 'rank', 1, 'rank>' . $old_rank . ' AND parent=' . $old_parent); // close in hole $db->increment($page->tablename, 'rank', 1, 'rank>=' . $new_rank . ' AND parent=' . $new_parent); // make room $params = array(); $params['parent'] = $new_parent; $params['rank'] = $new_rank; $page->update($params); self::checkForSectionalAdmins($id); expSession::clearAllUsersSessionCache('navigation'); }
CWE-89
0
public function rename($hash, $name) { if ($this->commandDisabled('rename')) { return $this->setError(elFinder::ERROR_PERM_DENIED); } if (!$this->nameAccepted($name)) { return $this->setError(elFinder::ERROR_INVALID_NAME, $name); } $mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name); if ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName)) { return $this->setError(elFinder::ERROR_INVALID_NAME, $name); } if (!($file = $this->file($hash))) { return $this->setError(elFinder::ERROR_FILE_NOT_FOUND); } if ($name == $file['name']) { return $file; } if (!empty($file['locked'])) { return $this->setError(elFinder::ERROR_LOCKED, $file['name']); } $path = $this->decode($hash); $dir = $this->dirnameCE($path); $stat = $this->stat($this->joinPathCE($dir, $name)); if ($stat) { return $this->setError(elFinder::ERROR_EXISTS, $name); } if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) { return $this->setError(elFinder::ERROR_PERM_DENIED); } $this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move if ($path = $this->convEncOut($this->_move($this->convEncIn($path), $this->convEncIn($dir), $this->convEncIn($name)))) { $this->clearcache(); return $this->stat($path); } return false; }
CWE-89
0
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
CWE-639
9
protected function getRootStatExtra() { $stat = array(); if ($this->rootName) { $stat['name'] = $this->rootName; } if (! empty($this->options['icon'])) { $stat['icon'] = $this->options['icon']; } if (! empty($this->options['rootCssClass'])) { $stat['csscls'] = $this->options['rootCssClass']; } if (! empty($this->tmbURL)) { $stat['tmbUrl'] = $this->tmbURL; } $stat['uiCmdMap'] = (isset($this->options['uiCmdMap']) && is_array($this->options['uiCmdMap']))? $this->options['uiCmdMap'] : array(); $stat['disabled'] = $this->disabled; if (isset($this->options['netkey'])) { $stat['netkey'] = $this->options['netkey']; } return $stat; }
CWE-89
0
private function addInlineReference($id, Definition $definition, $targetId, $forConstructor) { list($callCount, $behavior) = $this->serviceCalls[$targetId]; while ($this->container->hasAlias($targetId)) { $targetId = (string) $this->container->getAlias($targetId); } if ($id === $targetId) { return $this->addInlineService($id, $definition, $definition); } if ('service_container' === $targetId || isset($this->referenceVariables[$targetId])) { return ''; } $hasSelfRef = isset($this->circularReferences[$id][$targetId]); $forConstructor = $forConstructor && !isset($this->definitionVariables[$definition]); $code = $hasSelfRef && !$forConstructor ? $this->addInlineService($id, $definition, $definition) : ''; if (isset($this->referenceVariables[$targetId]) || (2 > $callCount && (!$hasSelfRef || !$forConstructor))) { return $code; } $name = $this->getNextVariableName(); $this->referenceVariables[$targetId] = new Variable($name); $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null; $code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference)); if (!$hasSelfRef || !$forConstructor) { return $code; } $code .= sprintf(<<<'EOTXT' if (isset($this->%s['%s'])) { return $this->%1$s['%2$s']; } EOTXT , 'services', $id ); return $code; }
CWE-89
0
static function description() { return "Manage events and schedules, and optionally publish them."; }
CWE-89
0
public function assignDefaultRoles() { global $gMessage, $gL10n; $this->db->startTransaction(); // every user will get the default roles for registration, if the current user has the right to assign roles // than the roles assignment dialog will be shown $sql = 'SELECT rol_id FROM '.TBL_ROLES.' INNER JOIN '.TBL_CATEGORIES.' ON cat_id = rol_cat_id WHERE rol_default_registration = 1 AND cat_org_id = ? -- $this->organizationId'; $defaultRolesStatement = $this->db->queryPrepared($sql, array($this->organizationId)); if ($defaultRolesStatement->rowCount() === 0) { $gMessage->show($gL10n->get('PRO_NO_DEFAULT_ROLE')); // => EXIT } while ($rolId = $defaultRolesStatement->fetchColumn()) { // starts a membership for role from now $this->setRoleMembership($rolId); } $this->db->endTransaction(); }
CWE-613
7
public function __destruct() { if (class_exists('ZipArchive')) { $this->Zip->close(); } }
CWE-78
6
public function __construct() { }
CWE-89
0
public static function install () { include(GX_PATH.'/inc/lib/Control/Install/default.control.php'); }
CWE-89
0
$searches[] = $wpdb->prepare( "u.{$field} LIKE %s", '%' . trim( $_POST['search'] ) . '%' ); } $core_search = implode( ' OR ', $searches ); $this->joins[] = "LEFT JOIN {$wpdb->prefix}um_metadata umm_search ON umm_search.user_id = u.ID"; $this->sql_where .= " AND ( umm_search.um_value = '" . trim( $_POST['search'] ) . "' OR umm_search.um_value LIKE '%" . trim( $_POST['search'] ) . "%' OR umm_search.um_value LIKE '%" . trim( serialize( strval( $_POST['search'] ) ) ) . "%' OR {$core_search})"; $this->is_search = true; }
CWE-639
9
public function saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->params); } } parent::saveConfig(); }
CWE-89
0
public function params() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) { $this->create(); return; } $action = $this->actionManager->getAction($values['action_name']); $action_params = $action->getActionRequiredParameters(); if (empty($action_params)) { $this->doCreation($project, $values + array('params' => array())); } $projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); unset($projects_list[$project['id']]); $this->response->html($this->template->render('action_creation/params', array( 'values' => $values, 'action_params' => $action_params, 'columns_list' => $this->columnModel->getList($project['id']), 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), 'projects_list' => $projects_list, 'colors_list' => $this->colorModel->getList(), 'categories_list' => $this->categoryModel->getList($project['id']), 'links_list' => $this->linkModel->getList(0, false), 'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project), 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'swimlane_list' => $this->swimlaneModel->getList($project['id']), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
CWE-639
9
public static function slug($vars) { $s = Db::result("SELECT `slug` FROM `posts` WHERE `id` = '{$vars}' LIMIT 1"); $s = $s[0]->slug; return $s; }
CWE-89
0
public static function hasChildren($i) { global $sections; if (($i + 1) >= count($sections)) return false; return ($sections[$i]->depth < $sections[$i + 1]->depth) ? true : false; }
CWE-89
0
public function confirm() { $task = $this->getTask(); $link = $this->getTaskLink(); $this->response->html($this->template->render('task_internal_link/remove', array( 'link' => $link, 'task' => $task, ))); }
CWE-639
9
public 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 static function hasChildren($i) { global $sections; if (($i + 1) >= count($sections)) return false; return ($sections[$i]->depth < $sections[$i + 1]->depth) ? true : false; }
CWE-89
0
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
CWE-307
26
protected function imgRotate($path, $degree, $bgcolor = '#ffffff', $destformat = null, $jpgQuality = null) { if (($s = @getimagesize($path)) == false || $degree % 360 === 0) { return false; } $result = false; // try lossless rotate if ($degree % 90 === 0 && in_array($s[2], array(IMAGETYPE_JPEG, IMAGETYPE_JPEG2000))) { $count = ($degree / 90) % 4; $exiftran = array( 1 => '-9', 2 => '-1', 3 => '-2' ); $jpegtran = array( 1 => '90', 2 => '180', 3 => '270' ); $quotedPath = escapeshellarg($path); $cmds = array( 'exiftran -i '.$exiftran[$count].' '.$path, 'jpegtran -rotate '.$jpegtran[$count].' -copy all -outfile '.$quotedPath.' '.$quotedPath ); foreach($cmds as $cmd) { if ($this->procExec($cmd) === 0) { $result = true; break; } } if ($result) { return $path; } } if (!$jpgQuality) { $jpgQuality = $this->options['jpgQuality']; } switch ($this->imgLib) { case 'imagick': try { $img = new imagick($path); } catch (Exception $e) { return false; } if ($img->getNumberImages() > 1) { $img = $img->coalesceImages(); do { $img->rotateImage(new ImagickPixel($bgcolor), $degree); } while ($img->nextImage()); $img = $img->optimizeImageLayers(); $result = $img->writeImages($path, true); } else { $img->rotateImage(new ImagickPixel($bgcolor), $degree); $result = $this->imagickImage($img, $path, $destformat, $jpgQuality); } $img->clear(); return $result ? $path : false; break; case 'gd': $img = $this->gdImageCreate($path,$s['mime']); $degree = 360 - $degree; list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x"); $bgcolor = imagecolorallocate($img, $r, $g, $b); $tmp = imageRotate($img, $degree, (int)$bgcolor); $result = $this->gdImage($tmp, $path, $destformat, $s['mime'], $jpgQuality); imageDestroy($img); imageDestroy($tmp); return $result ? $path : false; break; } return false; }
CWE-89
0
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
CWE-639
9
public 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
$pos = strpos($val, $match); if ($pos !== false) { if ($field != '') { $var = '$r' . getvarname($field); $itm = trim(substr($val, $pos + strlen($match))); if ($itm != '') eval($var . '="' . str_replace('"', '\"', $itm) . '";'); } if (!$scanall) break; } } } } if (empty($r)) { if ($hasreg) $r['registered'] = 'no'; } else { if ($hasreg) $r['registered'] = 'yes'; $r = format_dates($r, $dateformat); } return $r; }
CWE-94
14
foreach($item->attributes as $name => $value) if ($name !== 'id' && $name !== 'listId') $copy->$name = $value; $lineItems[] = $copy; } return $lineItems; }
CWE-79
1
function edit_vendor() { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); assign_to_template(array( 'vendor'=>$vendor )); } }
CWE-89
0
public function testTransformationGlobalHtmlReplace() { // Case 1 $actual = PMA_Transformation_globalHtmlReplace('', array()); $this->assertEquals( '', $actual ); // Case 2 $buffer = 'foobar'; $options = array( 'regex' => 'foo', 'regex_replace' => 'bar', 'string' => 'x[__BUFFER__]x' ); $actual = PMA_Transformation_globalHtmlReplace($buffer, $options); $this->assertEquals( 'xbarbarx', $actual ); }
CWE-79
1
function sigRenderTag ($input, array $args, Parser $parser, PPFrame $frame) { $username = $input; $img_url = sigGetAvatarUrl($username); $o = '<br>' . '<span class="scratch-sig">' . '<a href="/wiki/User:'.$username.'">' . '<img src="' . $img_url . '" width="18px" height="18px">' . '</a>' . ' ' . '<a href="/wiki/User:'.$username.'">' . '<b>'.$username.'</b>' . '</a>' . ' ' . '(' . '<a href="/wiki/User_Talk:'.$username.'">talk</a>' . ' | ' . '<a href="/wiki/Special:Contributions/'.$username.'">contribs</a>' . ')' . '</span>'; return $o; }
CWE-79
1
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
CWE-89
0
public function __invoke(Request $request, Expense $expense) { $this->authorize('update', $expense); $data = json_decode($request->attachment_receipt); if ($data) { if ($request->type === 'edit') { $expense->clearMediaCollection('receipts'); } $expense->addMediaFromBase64($data->data) ->usingFileName($data->name) ->toMediaCollection('receipts'); } return response()->json([ 'success' => 'Expense receipts uploaded successfully', ], 200); }
CWE-434
5
static public function resize($src, $dst, $width, $height, $crop=0){ if(!list($w, $h) = getimagesize($src)) return "Unsupported picture type!"; $type = strtolower(substr(strrchr($src,"."),1)); if($type == 'jpeg') $type = 'jpg'; switch($type){ case 'bmp': $img = imagecreatefromwbmp($src); break; case 'gif': $img = imagecreatefromgif($src); break; case 'jpg': $img = imagecreatefromjpeg($src); break; case 'png': $img = imagecreatefrompng($src); break; default : return "Unsupported picture type!"; } // resize if($crop){ if($w < $width or $h < $height) return "Picture is too small!"; $ratio = max($width/$w, $height/$h); $h = $height / $ratio; $x = ($w - $width / $ratio) / 2; $w = $width / $ratio; } else{ if($w < $width and $h < $height) return "Picture is too small!"; $ratio = min($width/$w, $height/$h); $width = $w * $ratio; $height = $h * $ratio; $x = 0; } $new = imagecreatetruecolor($width, $height); // preserve transparency if($type == "gif" or $type == "png"){ imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127)); imagealphablending($new, false); imagesavealpha($new, true); } imagecopyresampled($new, $img, 0, 0, $x, 0, $width, $height, $w, $h); switch($type){ case 'bmp': imagewbmp($new, $dst); break; case 'gif': imagegif($new, $dst); break; case 'jpg': imagejpeg($new, $dst); break; case 'png': imagepng($new, $dst); break; } return true; }
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 confirm() { global $db; // make sure we have what we need. if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.')); if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.')); // verify the id/key pair $id = $db->selectValue('subscribers','id', 'id='.$this->params['id'].' AND hash="'.$this->params['key'].'"'); if (empty($id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.')); // activate this users pending subscriptions $sub = new stdClass(); $sub->enabled = 1; $db->updateObject($sub, 'expeAlerts_subscribers', 'subscribers_id='.$id); // find the users active subscriptions $ealerts = expeAlerts::getBySubscriber($id); assign_to_template(array( 'ealerts'=>$ealerts )); }
CWE-89
0
public static function inFolder() { $uri = explode('/', Site::$url); if(count($uri) > 3) { return true; }else{ return false; } }
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
public function searchNew() { global $db, $user; //$this->params['query'] = str_ireplace('-','\-',$this->params['query']); $sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, "; $sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) as relevance, "; $sql .= "CASE when p.model like '" . $this->params['query'] . "%' then 1 else 0 END as modelmatch, "; $sql .= "CASE when p.title like '%" . $this->params['query'] . "%' then 1 else 0 END as titlematch "; $sql .= "from " . $db->prefix . "product as p INNER JOIN " . $db->prefix . "content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN " . $db->prefix . "expFiles as f ON cef.expFiles_id = f.id WHERE "; if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND '; $sql .= " match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) AND p.parent_id=0 "; $sql .= " HAVING relevance > 0 "; //$sql .= "GROUP BY p.id "; $sql .= "order by modelmatch,titlematch,relevance desc LIMIT 10"; eDebug($sql); $res = $db->selectObjectsBySql($sql); eDebug($res, true); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
CWE-89
0
foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $db->countObjects("eventdate", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1; $monthly[$weekNum][$dayNum]['number'] = ($monthly[$weekNum][$dayNum]['ts'] != -1) ? $ed->find("count", $locsql . " AND date >= " . expDateTime::startOfDayTimestamp($day['ts']) . " AND date <= " . expDateTime::endOfDayTimestamp($day['ts'])) : -1; } }
CWE-89
0
$confirm_string .= tep_draw_hidden_field('chosen[]', $customer_id); } } else { $confirm_string .= tep_draw_hidden_field('global', 'true'); } $confirm_string .= tep_draw_bootstrap_button(IMAGE_SEND, 'fas fa-paper-plane', null, 'primary', null, 'btn-success btn-block btn-lg'); $confirm_string .= '</form>'; } $confirm_string .= tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-angle-left', tep_href_link('newsletters.php', 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=send'), 'primary', null, 'btn-light mt-2'); return $confirm_string; }
CWE-79
1
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
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
CWE-639
9
public static function is_same($p1, $p2){ if($p1 == $p2){ return true; }else{ return false; } }
CWE-89
0
protected function load($id, $init = true) { global $login; try { $select = $this->zdb->select(self::TABLE); $select->limit(1) ->where(self::PK . ' = ' . $id); $results = $this->zdb->execute($select); $count = $results->count(); if ($count === 0) { if ($init === true) { $models = new PdfModels($this->zdb, $this->preferences, $login); $models->installInit(); $this->load($id, false); } else { throw new \RuntimeException('Model not found!'); } } else { $this->loadFromRs($results->current()); } } catch (Throwable $e) { Analog::log( 'An error occurred loading model #' . $id . "Message:\n" . $e->getMessage(), Analog::ERROR ); throw $e; } }
CWE-89
0
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "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