code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
$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 store($zdb) { try { $values = array( self::PK => $this->id, 'model_fields' => serialize($this->fields) ); if (!isset($this->id) || $this->id == '') { //we're inserting a new model ...
Base
1
public static function isHadParent($parent='', $menuid = ''){ if(isset($menuid)){ $where = " AND `menuid` = '{$menuid}'"; }else{ $where = ''; } if(isset($parent) && $parent != ''){ $parent = " `parent` = '{$parent}'"; }else{ ...
Base
1
public static function background($item_type, $item_id, $color) { global $DB; global $website; global $user; $DB->execute(' INSERT INTO nv_notes (id, website, user, item_type, item_id, background, note, date_created) VALUES ...
Base
1
function update($vars, &$errors) { if (!$vars['grace_period']) $errors['grace_period'] = __('Grace period required'); elseif (!is_numeric($vars['grace_period'])) $errors['grace_period'] = __('Numeric value required (in hours)'); elseif ($vars['grace_period'] > 8760) ...
Base
1
protected function stat($path) { if ($path === false || is_null($path)) { return false; } $is_root = ($path == $this->root); if ($is_root) { $rootKey = md5($path); if (!isset($this->sessionCache['rootstat'])) { $this->sessionCache['rootstat'] = array(); } if (! $this->isMyReload()) { // ...
Base
1
public function setUp() { $client = $this->getHttpClient(); $request = $this->getHttpRequest(); $this->request = new RestCreateSubscriptionRequest($client, $request); $this->request->initialize(array( 'name' => 'Test Subscription', 'descr...
Base
1
public function editTitle() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->title = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your title was updated succes...
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 static function cleanLink($fulllink) { if(substr($fulllink, -1) == '/') $fulllink = substr($fulllink, 0, -1); return $fulllink; }
Base
1
$escapedArgument .= '^%"'.substr($part, 1, -1).'"^%'; } else { // escape trailing backslash if ('\\' === substr($part, -1)) { $part .= '\\'; } $quote = true; $e...
Class
2
public function withQuery($query) { if (!is_string($query) && !method_exists($query, '__toString')) { throw new \InvalidArgumentException( 'Query string must be a string' ); } $query = (string) $query; if (substr($query, 0, 1) === '?') { ...
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, ))); }
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 _filePutContents($path, $content) { $res = false; if ($this->tmp) { $local = $this->getTempFile(); if (@file_put_contents($local, $content, LOCK_EX) !== false && ($fp = @fopen($local, 'rb'))) { clearstatcache(); $res = ftp_fput($this->connect, $path, $fp, $this->ftpMode($p...
Base
1
public function manage() { expHistory::set('manageable', $this->params); // build out a SQL query that gets all the data we need and is sortable. $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id '; $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_P...
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_paths WHERE website = '.protect($website->id), 'object' ); $out = $DB->result(); if($type='json') ...
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
function manage() { global $db; expHistory::set('manageable', $this->params); // $classes = array(); $dir = BASE."framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { ...
Base
1
self::removeLevel($kid->id); } }
Base
1
public function getBranches() { if (null === $this->branches) { $branches = array(); $bookmarks = array(); $this->process->execute('hg branches', $output, $this->repoDir); foreach ($this->process->splitLines($output) as $branch) { if ($bra...
Base
1
public static function totalCat($vars) { $posts = Db::result("SELECT `id` FROM `cat` WHERE `type` = '{$vars}'"); $npost = Db::$num_rows; return $npost; }
Base
1
public function getPurchaseOrderByJSON() { if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchase_order->find('all'); } echo json_encode($purchase_orders); }
Class
2
public function link($target, $link) { if (! windows_os()) { return symlink($target, $link); } $mode = $this->isDirectory($target) ? 'J' : 'H'; exec("mklink /{$mode} \"{$link}\" \"{$target}\""); }
Base
1
public function subscriptions() { global $db; expHistory::set('manageable', $this->params); // 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->par...
Base
1
function json_decode($json, $assoc=null) { return array(); }
Base
1
foreach ($nodes as $node) { if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) { if ($node->active == 1) { $text = str_pad('', ($depth + ($full ...
Base
1
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->par...
Class
2
public function rename(){ if($this->request->isMethod('POST')){ if(\Storage::move($this->request->input('old_file'), $this->request->input('new_file'))){ if($this->request->ajax()){ return response()->json(['success' => trans('File successfully renamed!')]);...
Base
1
public static function exist ($vars) { if(file_exists(GX_THEME.THEME.'/'.$vars.'.php')) { return true; }else{ return false; } }
Base
1
public function get_bitly () { $file = urldecode (join ('/', func_get_args ())); $link = $this->controller->absolutize ('/files/' . $file); return BitlyLink::lookup ($link); }
Base
1
public function autocomplete() { return; global $db; $model = $this->params['model']; $mod = new $model(); $srchcol = explode(",",$this->params['searchoncol']); /*for ($i=0; $i<count($srchcol); $i++) { if ($i>=1) $sql .= " OR "; $sql .= $srchc...
Base
1
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->act...
Base
1
public function init() { global $geo_mashup_options, $pagenow; // Enable this interface when the option is set and we're on a destination page $enabled = is_admin() && $geo_mashup_options->get( 'overall', 'located_object_name', 'user' ) == 'true' && preg_match( '/(user-edit|profile).php/', $pagenow ...
Class
2
}elseif(!in_array($k, $arr) && $k != 'paging'){ //self::error('404'); }else{ self::incFront('default'); } } }else{
Base
1
public function onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) { $opts = $this->opts; $volOpts = $volume->getOptionsPlugin('AutoResize'); if (is_array($volOpts)) { $opts = array_merge($this->opts, $volOpts); } if (! $opts['enable']) { return false; } $srcImgInfo = @getimagesize($sr...
Base
1
public static function sessionWrite() { $this->session->close(); }
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...
Class
2
unset($m[0][$i], $m[1][$i], $m[2][$i], $m[3][$i], $k, $v, $i); } } return $r; }
Base
1
public function bind($dn = null, $password = null) { /* Fetch current bind credentials. */ if (empty($dn)) { $dn = $this->_config['binddn']; } if (empty($password)) { $password = $this->_config['bindpw']; } /* Connect first, if we haven't ...
Class
2
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $category = $this->getCategory(); if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->...
Base
1
public static function isHadSub($parent, $menuid =''){ $sql = sprintf("SELECT * FROM `menus` WHERE `parent` = '%s' %s", $parent, $where); }
Compound
4
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_feeds WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); ...
Base
1
public function downloadfile() { if (empty($this->params['fileid'])) { flash('error', gt('There was an error while trying to download your file. No File Specified.')); expHistory::back(); } $fd = new filedownload($this->params['fileid']); if (empty(...
Class
2
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 delete_version() { if (empty($this->params['id'])) { flash('error', gt('The version you are trying to delete could not be found')); } // get the version $version = new help_version($this->params['id']); if (empty($version->id)) { flash('error', gt('The v...
Base
1
$dt = date('Y-m-d', strtotime($match)); $sql = par_rep("/'$match'/", "'$dt'", $sql); } } if (substr($sql, 0, 6) == "BEGIN;") { $array = explode(";", $sql); foreach ($array as $value) { if ($value != "") { $user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']); if ($user_...
Base
1
public function delete() { global $DB; $node_id_filter = ""; // remove all old entries 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)) ...
Base
1
static function description() { return "Manage events and schedules, and optionally publish them."; }
Class
2
public function __construct(OrderService $orderService) { $this->orderService = $orderService; }
Class
2
$layout[$position] = array($elem => $initLayout[$position][$elem]) + $layout[$position]; // unshift key-value pair $changed = true; } // remove obsolete widgets $arrayDiff = array_diff(array_keys($layoutWidgets), array_keys($initLayoutWidgets)); f...
Base
1
public function transformAssignedTo($asset) { if ($asset->checkedOutToUser()) { return $asset->assigned ? [ 'id' => (int) $asset->assigned->id, 'username' => e($asset->assigned->username), 'name' => e($asset->assigned->getFullNameAt...
Base
1
function showByModel() { global $order, $template, $db; expHistory::set('viewable', $this->params); $product = new product(); $model = $product->find("first", 'model="' . $this->params['model'] . '"'); //eDebug($model); $product_type = new $model->product_type($model...
Class
2
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...
Base
1
public function updateTab($id, $array) { if (!$id || $id == '') { $this->setAPIResponse('error', 'id was not set', 422); return null; } if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $tabInfo = $this->getTabById($id); if ($tabInfo) { $array = $this->c...
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->checkPermission($project, $filter); if ($this->customFilterModel->remove($filter['id']))...
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
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 delete_version() { if (empty($this->params['id'])) { flash('error', gt('The version you are trying to delete could not be found')); } // get the version $version = new help_version($this->params['id']); if (empty($version->id)) { flash('error', gt('The v...
Base
1
print_r($single_error); } echo '</pre>'; }
Base
1
private function filterPath($path) { return preg_replace_callback( '/(?:[^' . self::$charUnreserved . self::$charSubDelims . ':@\/%]+|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $path ); }
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 function testCheckLoginPassEntity() { $login=checkLoginPassEntity('loginbidon', 'passwordbidon', 1, array('dolibarr')); print __METHOD__." login=".$login."\n"; $this->assertEquals($login, ''); $login=checkLoginPassEntity('admin', 'passwordbidon', 1, array('dolibarr')); ...
Base
1
foreach ($elem[2] as $field) { echo ' <tr class="tr_fields itemCatName_'.$itemCatName.'"> <td valign="top" class="td_title">&nbsp;&nbsp;<span class="ui-icon ui-icon-carat-1-e" style="float: left; margin: 0 .3em 0 15px; font-size:9px;">&nbsp;</span>...
Base
1
public function actionGetItems(){ $model = X2Model::model ($this->modelClass); if (isset ($model)) { $tableName = $model->tableName (); $sql = 'SELECT id, fileName as value FROM '.$tableName.' WHERE associationType!="theme" ...
Class
2
public function getFileContent($file, $identifier) { $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file)); $this->process->execute($resource, $content, $this->repoDir); if (!trim($content)) { return null; } ...
Class
2
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
Base
1
function XMLRPCgetUserGroups($groupType=0, $affiliationid=0) { global $user; $groups = getUserGroups($groupType, $affiliationid); // Filter out any groups to which the user does not have access. $usergroups = array(); foreach($groups as $id => $group){ if($group['ownerid'] == $user['id'] ||...
Class
2
public function theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('D...
Base
1
public function up(RuleGroup $ruleGroup) { $order = (int)$ruleGroup->order; if ($order > 1) { $newOrder = $order - 1; $this->repository->setOrder($ruleGroup, $newOrder); } return redirect(route('rules.index')); }
Compound
4
$bool = self::evaluateTypedCondition($array, $expression); if (!$bool) { $hit->parentNode->removeChild($hit); } else { $hit->removeAttribute('n-if'); } } return $doc->saveHTML(); }
Class
2
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
Class
2
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, 'filt...
Base
1
public function testAuth() { if (! defined('PMA_TEST_HEADERS')) { $this->markTestSkipped( 'Cannot redefine constant/function - missing runkit extension' ); } // case 1 $GLOBALS['cfg']['Server']['SignonURL'] = ''; ob_start(); ...
Class
2
public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); // global $db; $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = ...
Base
1
public function __construct( $title, $namespace ) { $this->mTitle = $title; $this->mNamespace = $namespace; }
Class
2
public function execute(&$params){ $options = &$this->config['options']; $notif = new Notification; $notif->user = $this->parseOption('user', $params); $notif->createdBy = 'API'; $notif->createDate = time(); // file_put_contents('triggerLog.txt',"\n".$notif->user,FILE...
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
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'paren...
Base
1
: htmlspecialchars($host['User'])) . '</label></td>' . "\n" . '<td>' . htmlspecialchars($host['Host']) . '</td>' . "\n"; $html_output .= '<td>'; $password_column = 'Password'; $check_plugin_query = "SELECT * FROM `mysql`.`user` WHERE " ...
Base
1
private function _lastrevisionbefore( $option ) { $this->addTable( 'revision_actor_temp', 'rev' ); $this->addSelect( [ 'rev.revactor_rev', 'rev.revactor_timestamp' ] ); // tell the query optimizer not to look at rows that the following subquery will filter out anyway $this->addWhere( [ $this->tableNames...
Class
2
static function description() { return "Manage events and schedules, and optionally publish them."; }
Base
1
protected function redirectToGroup(Thread $thread, $group_id) { if ($thread->state != Thread::STATE_CHATTING) { // We can redirect only threads which are in proggress now. return false; } // Redirect the thread $thread->state = Thread::STATE_WAITING; ...
Base
1
public static function IsTransactionValid($id, $bRemoveTransaction = true) { // Constraint the transaction file within APPROOT.'data/transactions' $sTransactionDir = realpath(APPROOT.'data/transactions'); $sFilepath = utils::RealPath($sTransactionDir.'/'.$id, $sTransactionDir); if (($sFilepath === false) || (...
Compound
4
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...
Base
1
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name); if (!$view) { // unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child $attr = new stdClass(); $attr->class = 'hidde...
Base
1
public static function get_param($key = NULL) { $info = [ 'stype' => self::$search_type, 'stext' => self::$search_text, 'method' => self::$search_method, 'datelimit' => self::$search_date_limit, 'fields' => self::$searc...
Base
1
public function getSimilar($id){ $url = "http://api.themoviedb.org/3/movie/{$id}/similar?api_key=".$this->apikey; $similar = $this->curl($url); return $similar; }
Base
1
function draw_vdef_preview($vdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>vdef=<?php print get_vdef($vdef_id, true);?></pre> </td> </tr> <?php }
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
$rst[$key] = self::parseAndTrim($st, $unescape); } return $rst; } $str = str_replace("<br>"," ",$str); $str = str_replace("</br>"," ",$str); $str = str_replace("<br/>"," ",$str); $str = str_replace("<br />"," ",$str); $str = str_re...
Class
2
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_cou...
Class
2
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'paren...
Base
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->ge...
Base
1
public function show_screen_options() { global $wp_meta_boxes; if ( is_bool( $this->_show_screen_options ) ) return $this->_show_screen_options; $columns = get_column_headers( $this ); $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); switch ( $this-...
Compound
4
$subgroup->remove(true); } } Analog::log( 'Cascading remove ' . $this->group_name . '. Members and managers will be detached.', Analog::INFO ); //dele...
Base
1
$this->doDelete( $type, $dump ); } } $pager = new DataDumpPager( $this->getContext(), $this->getPageTitle() ); $out->addModuleStyles( 'mediawiki.special' ); $pager->getForm(); $out->addParserOutputContent( $pager->getFullOutput() ); }
Compound
4
function manage() { expHistory::set('viewable', $this->params); // $category = new storeCategory(); // $categories = $category->getFullTree(); // // // foreach($categories as $i=>$val){ // // if (!empty($this->values) && in_ar...
Base
1
$mime = mime_content_type($path); } elseif ($type === 'getimagesize') { if ($img = @getimagesize($path)) { $mime = $img['mime']; } } if ($mime) { $mime = explode(';', $mime); $mime = trim($mime[0]); if (in_array($mime, array('application/x-empty', 'inode/x-empty'))) { // finfo ret...
Base
1
public static function find_by_reference($reference, $website_id=null) { global $DB; global $website; if(empty($website_id)) $website_id = $website->id; $order_id = $DB->query_single( 'id', 'nv_orders', 'reference = '.p...
Base
1