code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
function addDiscountToCart() { // global $user, $order; global $order; //lookup discount to see if it's real and valid, and not already in our cart //this will change once we allow more than one coupon code $discount = new discounts(); $discount = $discount->getCoupon...
Class
2
final public function modifyLimitQuery($query, $limit, $offset = 0) { if ($offset < 0) { throw new Exception(sprintf( 'Offset must be a positive integer or zero, %d given', $offset )); } if ($offset > 0 && ! $this->supportsLimitOff...
Base
1
public static function content($vars) { $post = Typo::Xclean($vars); preg_match_all("[[\-\-readmore\-\-]]", $post, $more); if (is_array($more[0])) { $post = str_replace('[[--readmore--]]', '', $post); // return $post; }else{ $post = $pos...
Base
1
function __construct () { }
Base
1
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->f...
Base
1
$module_views[$key]['name'] = gt($value['name']); } // look for a config form for this module's current view // $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod); //check to see if hcview was passed along, indicating a hard-coded module // if (!empty($contr...
Base
1
protected function _chmod($path, $mode) { $modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode)); $ret = @chmod($path, $modeOct); $ret && clearstatcache(); return $ret; }
Base
1
public function testAuthCheckDecryptUser() { $GLOBALS['cfg']['Server']['auth_swekey_config'] = 'testConfigSwekey'; $GLOBALS['server'] = 1; $_REQUEST['old_usr'] = ''; $_REQUEST['pma_username'] = ''; $_COOKIE['pmaServer-1'] = 'pmaServ1'; $_COOKIE['pmaUser-1'] = 'pma...
Class
2
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, ))); }
Base
1
public function updateForgottenPassword(array $input) { $condition = [ 'glpi_users.is_active' => 1, 'glpi_users.is_deleted' => 0, [ 'OR' => [ ['glpi_users.begin_date' => null], ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]] ...
Base
1
static function isSearchable() { return true; }
Base
1
$fieldPickListValues[$value] = \App\Language::translate($value, $this->getModuleName(),false,false); } // Protection against deleting a value that does not exist on the list if ('picklist' === $fieldDataType) { $fieldValue = $this->get('fieldvalue'); if (!empty($fieldValue) && !isset($fieldPickList...
Class
2
public function offset($offset) { $this->ar_offset = $offset; return $this; }
Base
1
function selectArraysBySql($sql) { $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $arrays = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $arrays[] = mysqli_fetch_assoc($res); return $a...
Base
1
$module_views[$key]['name'] = gt($value['name']); } // look for a config form for this module's current view // $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod); //check to see if hcview was passed along, indicating a hard-coded module // if (!empty($contr...
Base
1
public static function sortByPriority( $parameters ) { if ( !is_array( $parameters ) ) { throw new \MWException( __METHOD__ . ': A non-array was passed.' ); } //'category' to get category headings first for ordermethod. //'include'/'includepage' to make sure section labels are ready for 'table'. $priority...
Class
2
protected function _add_log_attachment( $action, $attachment_id ) { $post = get_post( $attachment_id ); aal_insert_log( array( 'action' => $action, 'object_type' => 'Attachment', 'object_subtype' => $post->post_type, 'object_id' => $attachment_id, 'object_name' => get_the_title( ...
Base
1
public function __construct($exceptions = false) { $this->exceptions = ($exceptions == true); }
Compound
4
public function edit(Request $request, $id) { return $this->view('content::admin.content.edit', [ 'content_id'=>$id ]); }
Base
1
public function settings_save() { AuthUser::load(); if (!AuthUser::isLoggedIn()) { redirect(get_url('login')); } else if (!AuthUser::hasPermission('admin_edit')) { Flash::set('error', __('You do not have permission to access the requested page!')); redirec...
Class
2
public function getHeader($header) { $name = strtolower($header); return isset($this->headers[$name]) ? $this->headers[$name] : []; }
Base
1
public function remove($key) { $session =& $this->getSessionRef($key); unset($session); return $this; }
Base
1
public function confirm() { $task = $this->getTask(); $link = $this->getTaskLink(); $this->response->html($this->template->render('task_internal_link/remove', array( 'link' => $link, 'task' => $task, ))); }
Base
1
function PMA_secureSession() { // prevent session fixation and XSS // (better to use session_status() if available) if ((PMA_PHP_INT_VERSION >= 50400 && session_status() === PHP_SESSION_ACTIVE) || (PMA_PHP_INT_VERSION < 50400 && session_id() !== '') ) { session_regenerate_id(true); }...
Class
2
foreach ($all_users as &$u) { if ($u['username'] == $username && $this->verifyPassword($password, $u['password'])) { $user = $this->mapToUserObject($u); $this->store($user); $this->session->set(self::SESSION_HASH, $u['password']); retu...
Compound
4
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($r...
Base
1
function setup() { $this -> catch_globals(); $this -> version['prior'] = '01'; $this -> version['minor'] = '06'; $this -> version['fix'] = '01'; $this -> version_text = $this -> version['prior']; $this -> version_text .= '.'; $this -> version_text .= $this -> version['minor']; $this -> version_text ...
Base
1
public function __construct( AuthManager $auth, Repository $config, CacheRepository $cache, UserRepositoryInterface $repository, ViewFactory $view ) { parent::__construct($auth, $config); $this->view = $view; $this->cache = $cache; $this->...
Class
2
self::removeLevel($kid->id); } }
Base
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_u...
Base
1
protected function _chmod($path, $mode) { $modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode)); return @ftp_chmod($this->connect, $modeOct, $path); }
Base
1
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); } ...
Base
1
$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. ...
Base
1
function categoryBreadcrumb() { // global $db, $router; //eDebug($this->category); /*if(isset($router->params['action'])) { $ancestors = $this->category->pathToNode(); }else if(isset($router->params['section'])) { $current = $db->select...
Base
1
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
Base
1
function edit_internalalias() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages ...
Base
1
public function stripClean($str) { return $this->xssClean($this->stripTags($str)); }
Base
1
self::get($arr); } else { self::incFront('default'); } }
Base
1
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($th...
Base
1
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='setHiddenCheckboxStudent...
Base
1
public static function inFolder() { $uri = explode('/', Site::$url); if(count($uri) > 3) { return true; }else{ return false; } }
Base
1
public function create(Codendi_Request $request) { $content_id = false; $vId = new Valid_UInt($this->widget_id . '_job_id'); $vId->setErrorMessage("Can't add empty job id"); $vId->required(); if ($request->valid($vId)) { $job_id = $request->get($this->widget_i...
Base
1
public static function set_session($vars) { if (is_array($vars)) { if(is_array($_SESSION['gxsess']['val'])){ $arr = array_merge($_SESSION['gxsess']['val'], $vars); $_SESSION['gxsess']['val'] = $arr; }else{ $_SESSION['gxsess']['val...
Base
1
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('Acti...
Base
1
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 = ...
Base
1
function VerifyBlockedSchedule($columns,$course_period_id,$sec,$edit=false) { if($course_period_id!='new') { $cp_det_RET= DBGet(DBQuery("SELECT * FROM course_periods WHERE course_period_id=$course_period_id")); $cp_det_RET=$cp_det_RET[1]; $teacher=$cp_det_RET['TEACHER_ID']; $sectea...
Base
1
$parent = $dIF->getItemFromDb($item->getParentId()); $content .= '<tr>'; $content .= '<td>' . '<a href="/plugins/docman/?group_id=' . $params['group_id'] . '&action=details&id=' . $item->getId() . '">' . $item->getTitle() . '</a></td>'; $content .= '<td>...
Base
1
public function update_groupdiscounts() { global $db; if (empty($this->params['id'])) { // look for existing discounts for the same group $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']); if (!empty($existing_id)) flashAndFlow('er...
Base
1
public static function deactivate($mod){ $mods = Options::v('modules'); $mods = json_decode($mods, true); if (!is_array($mods) || $mods == "") { $mods = array(); } //print_r($mods); $arr = ""; for ($i=0;$i<count($mods);$i++) { ...
Base
1
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 successful...
Class
2
public static function canImportData() { return true; }
Class
2
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
Base
1
public function &storeicms_ipf_Object($debug=false, $xparam = false) { $ret =& $this->storeFromDefaultForm('', '', null, $debug, $xparam); return $ret; }
Base
1
function delete_option_master() { global $db; $masteroption = new option_master($this->params['id']); // delete any implementations of this option master $db->delete('option', 'option_master_id='.$masteroption->id); $masteroption->delete('optiongroup_master_id=' . $...
Base
1
public function post() { $args = $_POST; foreach ($this->dbFields as $key=>$value) { if (isset($args[$key])) { $value = Sanitize::html( $args[$key] ); if ($value==='false') { $value = false; } elseif ($value==='true') { $value = true; } settype($value, gettype($this->dbFields[$key])); $this...
Base
1
public function createTag($name, $options = NULL) { $this->run('tag', $options, $name); return $this; }
Class
2
public function confirm() { $task = $this->getTask(); $link = $this->getTaskLink(); $this->response->html($this->template->render('task_internal_link/remove', array( 'link' => $link, 'task' => $task, ))); }
Base
1
function edit_internalalias() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages ...
Class
2
public function editspeed() { global $db; if (empty($this->params['id'])) return false; $calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']); $calc = new $calcname($this->params['id']); assign_to_template(array( 'calculato...
Base
1
public static function delete($id){ $id = sprintf('%d', $id); $parent = self::getParent($id); $sql = array( 'table' => 'cat', 'where' => array( 'id' => $id ) ...
Base
1
public function __destruct() { if (class_exists('ZipArchive')) { $this->Zip->close(); } }
Base
1
public function testComments() { $antiXss = new \MicroweberPackages\Helper\HTMLClean(); $string = '<a href="https://example.com">test</a>'; $content = $antiXss->onlyTags($string); $this->assertEquals($string, $content); }
Base
1
protected function getFooService() { $a = new \App\Bar(); $b = new \App\Baz($a); $b->bar = $a; $this->services['App\Foo'] = $instance = new \App\Foo($b); $a->foo = $instance; return $instance; }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_items WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); return $out; ...
Base
1
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($...
Class
2
$logo = "<img src=\"".Options::get('siteurl').Options::get('logo')."\" style=\"width: $width; height: $height; margin: 1px;\">"; }else{ $logo = "<span class=\"mg genixcms-logo\"></span>"; } return $logo; }
Compound
4
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)); }
Base
1
function addDiscountToCart() { // global $user, $order; global $order; //lookup discount to see if it's real and valid, and not already in our cart //this will change once we allow more than one coupon code $discount = new discounts(); $discount = $discount->getCoupon...
Class
2
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException()...
Base
1
protected function renderText ($field, $makeLinks, $textOnly, $encode) { $fieldName = $field->fieldName; $value = preg_replace("/(\<br ?\/?\>)|\n/"," ",$this->owner->$fieldName); return Yii::app()->controller->convertUrls($this->render ($value, $encode)); }
Base
1
public function testRemoveCurlAuthorizationOptionsOnRedirect($auth) { if (!defined('\CURLOPT_HTTPAUTH')) { self::markTestSkipped('ext-curl is required for this test'); } $mock = new MockHandler([ new Response(302, ['Location' => 'http://test.com']), s...
Class
2
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'...
Base
1
function selectArraysBySql($sql) { $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($res == null) return array(); $arrays = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $arrays[] = mysqli_fetch_assoc($res...
Base
1
foreach ($data['alertred'] as $alert) { # code... echo "<li>$alert</li>\n"; }
Compound
4
function _makeChooseCheckbox($value, $title) { // return '<INPUT type=checkbox name=st_arr[] value=' . $value . ' checked>'; global $THIS_RET; return "<input name=unused[$THIS_RET[STUDENT_ID]] value=" . $THIS_RET[STUDENT_ID] . " type='checkbox' id=$THIS_RET[STUDENT_ID] onClick='setHiddenCheckboxStudents...
Base
1
public function newModel() { return new APIModel('testuser','5f4dcc3b5aa765d61d8327deb882cf99',rtrim(TEST_BASE_URL,'/')); }
Class
2
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); return $this->connect->rename($source, $target) ? $target : false; }
Base
1
public static function install () { include(GX_PATH.'/inc/lib/Control/Install/default.control.php'); }
Base
1
public function confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $swimlane, ))); }
Class
2
public function get_items( $request ) { $sked = get_template_sked( $request['post_id'] ); return new WP_REST_Response( $sked, 200 ); }
Base
1
function db_case($array) { global $DatabaseType; $counter = 0; if ($DatabaseType == 'mysqli') { $array_count = count($array); $string = " CASE WHEN $array[0] ="; $counter++; $arr_count = count($array); for ($i = 1; $i < $arr_count; $i++) { $value = $array[$i]; if ($value == "''" && substr($string, ...
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException()...
Base
1
public function activate_discount(){ if (isset($this->params['id'])) { $discount = new discounts($this->params['id']); $discount->update($this->params); //if ($discount->discountulator->hasConfig() && empty($discount->config)) { //flash('messages', $di...
Base
1
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') ))); }
Base
1
public static function returnChildrenAsJSON() { global $db; //$nav = section::levelTemplate(intval($_REQUEST['id'], 0)); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $nav = $db->selectObjects('section', 'parent=' . $id, 'rank'); //FIXME $m...
Class
2
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
Base
1
$incident_title = strip_tags(html_entity_decode(html_entity_decode($this->data->item_title, ENT_QUOTES)));
Base
1
public function save() { global $DB; // remove all old entries $node_id_filter = ''; if(!empty($this->node_id)) { if(is_numeric($this->node_id)) $node_id_filter .= ' AND node_id = '.intval($this->node_id); if(is_numeric($this->node_uid)) $node_id_filter .= ' AND node_uid ...
Base
1
public static function load($mod) { $file = GX_MOD."/".$mod."/index.php"; if(file_exists($file)){ include ($file); } }
Base
1
return @unlink($dir); } return false; }
Base
1
print "<option value='" . $device['id'] . "'"; if (get_request_var('host_id') == $device['id']) { print ' selected'; } print '>' . title_trim(htmlspecialchars($device['description'] . ' (' . $device['hostname'] . ')'), 40) . "</option>\n"; } } ?> </select> </td> <?php } else {
Base
1
function delete() { global $db; if (empty($this->params['id'])) return false; $product_type = $db->selectValue('product', 'product_type', 'id=' . $this->params['id']); $product = new $product_type($this->params['id'], true, false); //eDebug($product_type); //eDebug...
Base
1
public static function getTemplateHierarchyFlat($parent, $depth = 1) { global $db; $arr = array(); $kids = $db->selectObjects('section_template', 'parent=' . $parent, 'rank'); // $kids = expSorter::sort(array('array'=>$kids,'sortby'=>'rank', 'order'=>'ASC')); for ($i = 0, $i...
Base
1
public static function rss() { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/rss".GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')."/index....
Compound
4
public function StartTLS() { $this->error = null; # to avoid confusion if(!$this->connected()) { $this->error = array("error" => "Called StartTLS() without being connected"); return false; } fputs($this->smtp_conn,"STARTTLS" . $this->CRLF); $rply = $this->get_lines(); $code = su...
Base
1
function check_app_exists($uniq_name, $bdd) { $sql = "select count(*) from bp where name = '" . $uniq_name . "';"; $req = $bdd->query($sql); $bp_exist = $req->fetch(PDO::FETCH_NUM); if($bp_exist[0] == 1){ echo "true"; } else { echo "false"; } }
Base
1
public function validate() { global $db; // check for an sef url field. If it exists make sure it's valid and not a duplicate //this needs to check for SEF URLS being turned on also: TODO if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) { ...
Base
1
public static function post($vars) { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/".self::slug($vars)."/{$vars}"; break; default: # code... $url = Options::get('...
Base
1
public function update_version() { // get the current version $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); // check to see if the we have a new current version and unset the old current version. if (!empty($this->params['is_current'])) { // $db...
Base
1
public function getQueryGroupby() { return "a.per_tracker_artifact_id"; }
Base
1