code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
$doRegist = (strpos($cmd, '*') !== false); if (! $doRegist) { $_getcmd = create_function('$cmd', 'list($ret) = explode(\'.\', $cmd);return trim($ret);'); $doRegist = ($_reqCmd && in_array($_reqCmd, array_map($_getcmd, explode(' ', $cmd)))); } if ($doRegist) { if (! is_array($handlers) || ...
Base
1
$controller = new $ctlname(); if (method_exists($controller,'isSearchable') && $controller->isSearchable()) { // $mods[$controller->name()] = $controller->addContentToSearch(); $mods[$controller->searchName()] = $controller->addContentToSearch(); } } uksort($mods,'str...
Class
2
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...
Base
1
public function __construct( AuthManager $auth, Encrypter $encrypter, Google2FA $google2FA, Repository $config, CacheRepository $cache, RecoveryTokenRepository $recoveryTokenRepository, UserRepositoryInterface $repository ) { parent::__construct($a...
Class
2
public function approve_toggle() { if (empty($this->params['id'])) return; /* 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['re...
Base
1
public function testOpen() { $this->mock->expects($this->once()) ->method('open') ->will($this->returnValue(true)); $this->assertFalse($this->proxy->isActive()); $this->proxy->open('name', 'id'); if (PHP_VERSION_ID < 50400) { $this->assertTrue...
Base
1
function update_vendor() { $vendor = new vendor(); $vendor->update($this->params['vendor']); expHistory::back(); }
Base
1
public function confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, 'proje...
Base
1
public function enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully...
Base
1
public static function isAnimationGif($path) { list($width, $height, $type, $attr) = getimagesize($path); switch ($type) { case IMAGETYPE_GIF: break; default: return false; } $imgcnt = 0; $fp = fopen($path, 'rb'); @fread($fp, 4); $c = @fread($fp,1); if (ord($c) != 0x39) { // GIF89a ...
Base
1
function reset_stats() { // global $db; // reset the counters // $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1'); banner::resetImpressions(); // $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1'); banner::resetClicks(); /...
Base
1
function searchByModelForm() { // get the search terms $terms = $this->params['search_string']; $sql = "model like '%" . $terms . "%'"; $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10; $page = new expPaginator(array( 'model' => 'produc...
Class
2
function show_vendor () { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); $vendor_title = $vendor->title; $state = new geoRegion($vendor->state); $vendor->state = $state->name; //Removed unnecessary fields unset( ...
Base
1
public function remind() { /*if (!check_captcha()) { $this->templatemanager->notify_next(__("You have entered wrong security code."), "error", __("Error!")); redirect("administration/auth/forgot"); die; }//*/ $email = trim($this->input->post("email", true)); $u = User::factory()->get_by_email($em...
Base
1
public function getQueryOrderby() { return '`' . $this->name . '`'; }
Base
1
public function showUnpublished() { expHistory::set('viewable', $this->params); // setup the where clause for looking up records. $where = parent::aggregateWhereClause(); $where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where; ...
Class
2
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 J...
Class
2
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
Base
1
foreach ($flatArray as $key => $value) { $pattern = '/' . $key . '([^.]|$)/'; if (preg_match($pattern, $expression, $matches)) { switch (gettype($flatArray[$key])) { case 'boolean': $expression = str_replace($key, $flatArray[$k...
Variant
0
$percent = round($percent, 0); } else { $percent = round($percent, 2); // school default } if ($ret == '%') return $percent; if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id]) $_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TI...
Base
1
public function manage_sitemap() { global $db, $user, $sectionObj, $sections; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // all we need to do is determine the current section $navsections = $sections; if (...
Base
1
static function validUTF($string) { if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { return false; } return true; }
Base
1
public function fixsessions() { global $db; // $test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket'); $fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket'); flash('message', gt('Sessions Table was Repaired')); expHistory::back(); }
Base
1
public function update_discount() { $id = empty($this->params['id']) ? null : $this->params['id']; $discount = new discounts($id); // find required shipping method if needed if ($this->params['required_shipping_calculator_id'] > 0) { $this->params['required_shipping_metho...
Base
1
public function getQuerySelect() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return "$R2.id AS `" . $this->field->name . "`"; }
Base
1
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
Base
1
public function actionDeleteDropdown() { $dropdowns = Dropdowns::model()->findAll(); if (isset($_POST['dropdown'])) { if ($_POST['dropdown'] != Actions::COLORS_DROPDOWN_ID) { $model = Dropdowns::model()->findByPk($_POST['dropdown']); $model->delete(); ...
Base
1
public static function showModal($params) { if (!isset($params['argument']) || empty($params['argument'])) { return array( 'processed' => true, 'process_status' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chatcommand', 'Please provide ...
Class
2
function storeSerializedSession($serialized_session_data, $session_id) { $doSession = OA_Dal::staticGetDO('session', $session_id); if ($doSession) { $doSession->sessiondata = $serialized_session_data; $doSession->update(); } else { $doSession =...
Compound
4
public static function recent($vars, $type = 'post') { $sql = "SELECT * FROM `posts` WHERE `type` = '{$type}' ORDER BY `date` DESC LIMIT {$vars}"; $posts = Db::result($sql); if(isset($posts['error'])){ $posts['error'] = "No Posts found."; }else{ $posts = $post...
Base
1
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(); }
Base
1
public function testEncrypt($string, $key, $expected) { $this->string(\Toolbox::encrypt($string, $key))->isIdenticalTo($expected); }
Class
2
$contents = ['form' => tep_draw_form('testimonials', 'testimonials.php', 'page=' . $_GET['page'] . '&tID=' . $tInfo->testimonials_id . '&action=deleteconfirm')];
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
foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; return $event->id === $eventid;')); if (!empty($multiday_event)) { ...
Base
1
public function testAddsSlashForRelativeUriStringWithHost() { $uri = (new Uri)->withPath('foo')->withHost('bar.com'); $this->assertEquals('foo', $uri->getPath()); $this->assertEquals('bar.com/foo', (string) $uri); }
Base
1
public function setPageTextMatch( array $pageTextMatch = [] ) { $this->pageTextMatch = (array)$pageTextMatch; }
Class
2
function XMLRPCaddImageGroupToComputerGroup($imageGroup, $computerGroup){ $imageid = getResourceGroupID("image/$imageGroup"); $compid = getResourceGroupID("computer/$computerGroup"); if($imageid && $compid){ $tmp = getUserResources(array("imageAdmin"), array("manageMa...
Class
2
function gce_ajax_list() { $nonce = $_POST['gce_nonce']; // check to see if the submitted nonce matches with the // generated nonce we created earlier if ( ! wp_verify_nonce( $nonce, 'gce_ajax_nonce' ) ) { die ( 'Request has failed.'); } $grouped = $_POST['gce_grouped']; $start ...
Base
1
public function delete() { global $db; /* 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']) ? COMMENTS_REQUIRE_LO...
Base
1
public function testDolEval() { global $conf,$user,$langs,$db; $conf=$this->savconf; $user=$this->savuser; $langs=$this->savlangs; $db=$this->savdb; $result=dol_eval('1==1', 1, 0); print "result = ".$result."\n"; $this->assertTrue($result); $result=dol_eval('1==2', 1, 0); print "result = ".$resu...
Base
1
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
Base
1
$text = preg_replace($exp, '', $text); } // Primary expression to filter out tags $exp = '/(?:^|\s|\.)(#\w+[-\w]+\w+|#\w+)(?:$|[^\'"])/u'; $matches = array(); preg_match_all($exp, $text, $matches); return $matches; }
Base
1
public function addFile($filename, $conditional_ie = false) { $hash = md5($filename); if (!empty($this->_files[$hash])) { return; } $has_onload = $this->_eventBlacklist($filename); $this->_files[$hash] = array( 'has_onload' => $has_onload, ...
Base
1
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1
public function crossOriginRedirectProvider() { return [ ['http://example.com?a=b', 'http://test.com/', false], ['https://example.com?a=b', 'https://test.com/', false], ['http://example.com?a=b', 'https://test.com/', false], ['https://example.com?a=b', 'ht...
Class
2
static function author() { return "Dave Leffler"; }
Base
1
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank")...
Base
1
public static function getKey ($var) { return self::$hooks[$var]; }
Base
1
form_end_row(); $i++; } html_end_box(false); /* print "<pre>"; if (isset($check) && is_array($check)) { print_r($check); } print "</pre>"; */ }
Base
1
static function displayname() { return gt("e-Commerce Category Manager"); }
Base
1
public function updatePreferences(Codendi_Request $request) { $request->valid(new Valid_String('cancel')); if (!$request->exist('cancel')) { $job_id = $request->get($this->widget_id . '_job_id'); $sql = "UPDATE plugin_hudson_widget SET job_id=" . $job_id . " WHERE owner_i...
Base
1
public static function getList () { $handle = dir(GX_PATH.'/inc/lang/'); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $file = GX_PATH.'/inc/lang/'.$entry; $ext = pathinfo($file, PATHINFO_EXTENSION); ...
Base
1
public static function _date2timestamp( $datetime, $wtz=null ) { if( !isset( $datetime['hour'] )) $datetime['hour'] = 0; if( !isset( $datetime['min'] )) $datetime['min'] = 0; if( !isset( $datetime['sec'] )) $datetime['sec'] = 0; if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || emp...
Base
1
$opt .= "<option value=\"{$key}\" title=\"".htmlspecialchars($value)."\" {$sel}>".htmlspecialchars($value)."</option>"; } return $opt; }
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
$value = str_replace($originalName, $cleanedName, $value); } unset($value); } $result = hash_equals(GeneralUtility::hmac(serialize($fieldChangeFunctions)), $this->parameters['fieldChangeFuncHash']); } return $result; }
Class
2
public static function desc($vars){ if(!empty($vars)){ $desc = substr(strip_tags(htmlspecialchars_decode($vars).". ".self::$desc),0,150); }else{ $desc = substr(self::$desc,0,150); } $desc = Hooks::filter('site_desc_filter', $desc); return $desc;...
Base
1
public function approve() { expHistory::set('editable', $this->params); /* 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['requi...
Base
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'], '(')); ...
Base
1
public function renderAttribute ($name) { switch ($name) { case 'name': echo $this->relatedModel->getLink (/*array ( 'class' => 'quick-read-link', 'data-id' => $this->relatedModel->id, 'data-class' => get_class ($this->r...
Class
2
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 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
public function getRequestFormat($default = 'html') { if (null === $this->format) { $this->format = $this->get('_format', $default); } return $this->format; }
Base
1
static public function getCategoryName($_id = 0) { if ($_id != 0) { $stmt = Database::prepare(" SELECT `name` FROM `" . TABLE_PANEL_TICKET_CATS . "` WHERE `id` = :id" ); $category = Database::pexecute_first($stmt, array('id' => $_id)); return $category['name']; } return null; }
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 confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, 'proje...
Base
1
protected function itemLocked($hash) { if (!elFinder::$commonTempPath) { return false; } $lock = elFinder::$commonTempPath . DIRECTORY_SEPARATOR . $hash . '.lock'; if (file_exists($lock)) { if (filemtime($lock) + $this->itemLockExpire < time()) { ...
Base
1
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 )); }
Base
1
function format_install_param( $value ) { $value = str_replace( array( "'", "\$" ), array( "\'", "\\$" ), $value ); return preg_replace( "#([\\\\]*)(\\\\\\\')#", "\\\\\\\\\\\\\\\\\'", $value ); }
Class
2
public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response) { if (\strpos((string) $response->getStatusCode(), '3') !== 0 || !$response->hasHeader('Location') ) { return $response; } $this->guardMax($request, $res...
Class
2
public static function add($tags) { $tag = explode(",", $tags); foreach ($tag as $t) { if (self::exist($t)) { return false; }else{ $slug = Typo::slugify(Typo::cleanX($t)); $cat = Typo::cleanX($t); $tag ...
Base
1
private function drain(StreamInterface $source, StreamInterface $sink) { Psr7\copy_to_stream($source, $sink); $sink->seek(0); $source->close(); return $sink; }
Base
1
static function validUTF($string) { if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { return false; } return true; }
Base
1
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id); if (!empty($newret)) $ret .= $newret . '<br>'; if ($iLoc->mod == 'container') { $ret .= scan_container($container->internal, $page_id); } } retu...
Base
1
public function breadcrumb() { global $sectionObj; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // Show not only the location of a page in the hierarchy but also the location of a standalone page $current = new secti...
Base
1
public function setContainer($container) { $this->container = $container; $container->setType('ctArticles'); }
Base
1
function nvweb_website_comments_list($offset=0, $limit=2147483647, $permission=NULL, $order='oldest') { global $DB; global $website; global $current; if($order=='newest') $orderby = "nvc.date_created DESC"; else $orderby = "nvc.date_created ASC"; $DB->query('SELECT S...
Base
1
public function __construct() { parent::__construct(); $this->middleware( function ($request, $next) { app('view')->share('title', (string) trans('firefly.currencies')); app('view')->share('mainTitleIcon', 'fa-usd'); $this->repository ...
Compound
4
public function testGetRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId) { $request = new Enlight_Controller_Request_RequestTestCase(); $request->setMethod('GET'); $response = new Enlight_Controller_Response_ResponseTestCase(); $request->setPathI...
Base
1
public function savePassword() { $user = $this->getUser(); $values = $this->request->getValues(); list($valid, $errors) = $this->userValidator->validatePasswordModification($values); if (! $this->userSession->isAdmin()) { $values['id'] = $this->userSession->getId();...
Base
1
static function searchUser(AuthLDAP $authldap) { if (self::connectToServer($authldap->getField('host'), $authldap->getField('port'), $authldap->getField('rootdn'), Toolbox::decrypt($authldap->getField('rootdn_passwd'), GLPIKEY), ...
Class
2
if ($current_realm_id == -1 || is_realm_allowed($current_realm_id) || !isset($user_auth_realm_filenames{basename($item_url)})) { /* draw normal (non sub-item) menu item */ $item_url = $config['url_path'] . $item_url; if (is_menu_pick_active($item_url)) { print "<li><a role='menuitem' class...
Base
1
public function load_by_hash($hash) { global $DB; global $session; global $events; $ok = $DB->query('SELECT * FROM nv_webusers WHERE cookie_hash = '.protect($hash)); if($ok) $data = $DB->result(); if(!empty($data)) { $this->load_from_resultset($data);...
Base
1
public static function startup() { //Override the default expire time of token \CsrfMagic\Csrf::$expires = 259200; \CsrfMagic\Csrf::$callback = function ($tokens) { throw new \App\Exceptions\AppException('Invalid request - Response For Illegal Access', 403); }; $js = 'vendor/yetiforce/csrf-magic/src/Csrf...
Compound
4
function productFeed() { // global $db; //check query password to avoid DDOS /* * condition = new * description * id - SKU * link * price * title * brand - manufacturer ...
Class
2
$json_response = ['status' => 'error', 'message' => $e->getMessage()];
Base
1
function extract_plural_forms_header_from_po_header($header) { if (preg_match("/(^|\n)plural-forms: ([^\n]*)\n/i", $header, $regs)) $expr = $regs[2]; else $expr = "nplurals=2; plural=n == 1 ? 0 : 1;"; return $expr; }
Base
1
static function isSearchable() { return true; }
Base
1
$product = X2Model::model('Products')->findByAttributes(array('name'=>$lineItem->name)); if (isset($product)) $lineItem->productId = $product->id; if(empty($lineItem->currency)) $lineItem->currency = $defaultCurrency; if($lin...
Class
2
private function getNewPrinter() { $printer = getItemByTypeName('Printer', '_test_printer_all'); $pfields = $printer->fields; unset($pfields['id']); unset($pfields['date_creation']); unset($pfields['date_mod']); $pfields['name'] = $this->getUniqueString(); $this->integer((...
Base
1
function ac_checkme($id, $name) { global $cms_db; $ret = true; $cquery = sprintf("select count(*) from %s where sid='%s' and name='%s'", $cms_db['sessions'], $id, $name); $squery = sprintf("select sid from %s where sid = '%s' and name = '%s'", ...
Base
1
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'"); } if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records); // eDebug($sql, true); // count the ...
Base
1
protected function generateCookieHash($class, $username, $expires, $password) { return hash_hmac('sha256', $class.$username.$expires.$password, $this->getSecret()); }
Class
2
function select_string($n) { if (!is_int($n)) { throw new InvalidArgumentException( "Select_string only accepts integers: " . $n); } $string = $this->get_plural_forms(); $string = str_replace('nplurals',"\$total",$string); $string = str_replace("n",$n,$string); $string = str_repl...
Base
1
public function disable($id) { $this->active($id, FALSE); }
Compound
4
public function delete(){ $page_id = I("page_id/d")? I("page_id/d") : 0; $page = D("Page")->where(" page_id = '$page_id' ")->find(); $login_user = $this->checkLogin(); if (!$this->checkItemManage($login_user['uid'] , $page['item_id']) && $login_user['uid'] != $page['author_uid']) { ...
Compound
4
function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) { if (empty($endtimestamp)) { $date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($timestamp) . ")"; } else {...
Base
1
public function getQuerySelect() { return "R_{$this->id}.rank AS `$this->name`"; }
Base
1
public function testUserCredentials($email, $password, $server, $port, $security) { require_once(realpath(Yii::app()->basePath.'/components/phpMailer/class.phpmailer.php')); require_once(realpath(Yii::app()->basePath.'/components/phpMailer/class.smtp.php')); $phpMail = new PHPMailer(true); ...
Class
2