code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
foreach ($days as $value) { $regitem[] = $value; }
Base
1
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->...
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 != "") { $result = $connection->query($value); if (!$result) { $connecti...
Base
1
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
Base
1
private function resolveTrustedProxy() { if (!$trustedProxies = Request::getTrustedProxies()) { return '127.0.0.1'; } $firstTrustedProxy = reset($trustedProxies); return false !== ($i = strpos($firstTrustedProxy, '/')) ? substr($firstTrustedProxy, 0, $i) : $firstTru...
Class
2
public function backup($type='json') { global $DB; global $website; $DB->query('SELECT * FROM nv_payment_methods WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return $...
Base
1
public function editAlt() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->alt = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your alt was updated succ...
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
} elseif ($part != '.') { $depath++; }
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']))...
Class
2
$this->{$callback[0]}->{$callback[1]}($objPage, $objLayout, $this); } } $headBag = $this->responseContext->get(HtmlHeadBag::class); // Set the page title and description AFTER the modules have been generated $this->Template->mainTitle = $objPage->rootPageTitle; $this->Template->pageTitle = htmlspecia...
Base
1
function searchName() { return gt('Webpage'); }
Class
2
Session::set(array('lang' => $lang ) ); }
Base
1
public static function getSetting( $setting ) { return ( array_key_exists( $setting, self::$settings ) ? self::$settings[$setting] : null ); }
Class
2
function reparent_standalone() { $standalone = $this->section->find($this->params['page']); if ($standalone) { $standalone->parent = $this->params['parent']; $standalone->update(); expSession::clearAllUsersSessionCache('navigation'); expHistory::...
Base
1
protected function init() { if (!($this->options['host'] || $this->options['socket']) || !$this->options['user'] || !$this->options['pass'] || !$this->options['db'] || !$this->options['path'] || !$this->options['files_table']) { return false; } $this->db = new mysqli($this->options['...
Base
1
private function get_lines() { $data = ""; $endtime = 0; /* If for some reason the fp is bad, don't inf loop */ if (!is_resource($this->smtp_conn)) { return $data; } stream_set_timeout($this->smtp_conn, $this->Timeout); if ($this->Timelimit > 0) { $endtime = time() + $this->Tim...
Base
1
$banner->increaseImpressions(); } } // assign banner to the template and show it! assign_to_template(array( 'banners'=>$banners )); }
Base
1
public function remove() { $project = $this->getProject(); $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { ...
Base
1
static function convertUTF($string) { return $string = str_replace('?', '', htmlspecialchars($string, ENT_IGNORE, 'UTF-8')); }
Base
1
function &getAll(&$dbh, $proposalId) { $sql = "SELECT *, UNIX_TIMESTAMP(timestamp) AS timestamp FROM package_proposal_votes WHERE pkg_prop_id = ". $dbh->quoteSmart($proposalId) ." ORDER BY timestamp ASC"; $res = $dbh->query($sql); if (DB::isError($res)) { return $res; ...
Base
1
function edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['o...
Class
2
public function confirm() { $task = $this->getTask(); $link_id = $this->request->getIntegerParam('link_id'); $link = $this->taskExternalLinkModel->getById($link_id); if (empty($link)) { throw new PageNotFoundException(); } $this->response->html($this...
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...
Class
2
public function createFromBill(Request $request, Bill $bill) { $request->session()->flash('info', (string)trans('firefly.instructions_rule_from_bill', ['name' => $bill->name])); $this->createDefaultRuleGroup(); $this->createDefaultRule(); $preFilled = [ 'strict' ...
Base
1
public function showall() { expHistory::set('viewable', $this->params); // figure out if should limit the results if (isset($this->params['limit'])) { $limit = $this->params['limit'] == 'none' ? null : $this->params['limit']; } else { $limit = (isset($this->co...
Base
1
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
private function configureDefaults(array $config) { $defaults = [ 'allow_redirects' => RedirectMiddleware::$defaultSettings, 'http_errors' => true, 'decode_content' => true, 'verify' => true, 'cookies' => false ]; ...
Base
1
public function actionSeoFileLink($url, $robots = '', $canonical = '', $inline = true, $fileName = '') { $url = base64_decode($url); $robots = base64_decode($robots); $canonical = base64_decode($canonical); $url = UrlHelper::absoluteUrlWithProtocol($url); $contents = file...
Base
1
self::removeLevel($kid->id); } }
Base
1
protected function _save($fp, $dir, $name, $stat) { $this->clearcache(); $mime = $stat['mime']; $w = !empty($stat['width']) ? $stat['width'] : 0; $h = !empty($stat['height']) ? $stat['height'] : 0; $id = $this->_joinPath($dir, $name); rewind($fp); $stat = fstat($fp); $size = $stat['size']; ...
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); }
Base
1
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
Class
2
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 static function cat($vars) { switch (SMART_URL) { case true: # code... $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":""; $url = Site::$url.$inFold."/category/".$vars."/".Typo::slugify(Categories::name($vars)); ...
Base
1
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 function getQuerySelect() { return "c.submitted_by AS `" . $this->name . "`"; }
Base
1
public function confirm() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask/remove', array( 'subtask' => $subtask, 'task' => $task, ))); }
Class
2
protected function _renderVarInput_number($form, &$var, &$vars) { $value = $var->getValue($vars); if ($var->type->getProperty('fraction')) { $value = sprintf('%01.' . $var->type->getProperty('fraction') . 'f', $value); } $linfo = Horde_Nls::getLocaleInfo(); /*...
Base
1
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
protected function unserialize(string $data) { if (is_numeric($data)) { return $data; } $unserialize = $this->options['serialize'][1] ?? "unserialize"; return $unserialize($data); }
Base
1
public function chmod() { if (!AuthUser::hasPermission('file_manager_chmod')) { Flash::set('error', __('You do not have sufficient permissions to change the permissions on a file or directory.')); redirect(get_url('plugin/file_manager/browse/')); } // CSRF checks ...
Class
2
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 (...
Class
2
public function test_valid_comment_allow_empty_content() { add_filter( 'allow_empty_comment', '__return_true' ); $result = $this->myxmlrpcserver->wp_newComment( array( 1, 'administrator', 'administrator', self::$post->ID, array( 'content' => ' ', ), ) ); $this->assertNotIX...
Class
2
public function testNoAuthority($input) { $uri = new Uri($input); $this->assertEquals($input, (string) $uri); }
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
private function generateTempFileData() { return [ 'name' => md5(mt_rand()), 'tmp_name' => tempnam(sys_get_temp_dir(), ''), 'type' => 'image/jpeg', 'size' => mt_rand(1000, 10000), 'error' => '0', ]; }
Class
2
public function update() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $values = $this->request->getValues(); list($valid, $errors) = $this->tagValidator->validateModification($values); ...
Base
1
public function setContainer($container, $type = 'ctText') { $this->container = $container; $container->setType($type); }
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 ...
Class
2
public function push($remote = NULL, array $params = NULL) { $this->run('push', $remote, $params); return $this; }
Class
2
public function addTab($array) { if (!$array) { $this->setAPIResponse('error', 'no data was sent', 422); return null; } $array = $this->checkKeys($this->getTableColumnsFormatted('tabs'), $array); $array['group_id'] = ($array['group_id']) ?? $this->getDefaultGroupId(); $array['category_id'] = ($array['...
Base
1
public function __construct($mongo, array $options) { if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) { throw new \InvalidArgumentException('MongoClient or Mongo instance required'); } if (!isset($options['database']) || !isset($options['collection'])) { ...
Base
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
Base
1
protected function getStatusCode($exception) { if ($exception instanceof HttpExceptionInterface) { $code = $exception->getStatusCode(); } elseif ($exception instanceof AjaxException) { $code = 406; } else { $code = 500; ...
Base
1
$pos = strpos($line, $match); if ($pos !== false) { $var = getvarname(strtok($field, '#')); if ($var != '[]') eval('$r' . $var . '=$block;'); } } } return $r; }
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)) { ...
Class
2
function manage_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all...
Class
2
public function event() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id'])) { return $this->create(); } return $this->response->html($this->template->render('action_creat...
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
public static function flag($vars) { switch (SMART_URL) { case true: $lang = '?lang=' . $vars; if (isset($_GET['lang'])) { $uri = explode('?', $_SERVER['REQUEST_URI']); $uri = $uri[0]; }else{ ...
Base
1
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'] . "...
Class
2
public function update() { try { $_recipients = array(); if ($this->recipients != null) { foreach ($this->recipients as $_r) { $_recipients[$_r->id] = $_r->sname . ' <' . $_r->email . '>'; } } $sender = ...
Base
1
$link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr ); } else { $link_text = ''; } if ( trim( $link_text ) == '' ) $link_text = $_post->post_title; /** * Filters a retrieved attachment page link. * * @since 2.7.0 * * @param string $link_html The page link HTML output. * @...
Base
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
Base
1
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
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
foreach ($day as $extevent) { $event_cache = new stdClass(); $event_cache->feed = $extgcalurl; $event_cache->event_id = $extevent->event_id; $event_cache->title = $extevent->title; ...
Class
2
public static function is_email($vars){ if(isset($_GET['act']) && $_GET['act'] == 'edit'){ $id = Typo::int($_GET['id']); $where = "AND `id` != '{$id}' "; }else{ $where = ''; } $vars = sprintf('%s', Typo::cleanX($vars)); $s...
Base
1
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) { $resu...
Base
1
foreach ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); }
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully...
Base
1
foreach ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); }
Base
1
function fix_serialized_columns() { global $smcFunc; $request = $smcFunc['db_query']('', ' SELECT id_action, extra FROM {db_prefix}log_actions WHERE action IN ({string:remove}, {string:delete})', array( 'remove' => 'remove', 'delete' => 'delete', ) ); while ($row = $smcFunc['db_fetch_assoc']($reque...
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
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') { $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; } }
Base
1
public function getDisplayName ($plural=true) { return Yii::t('calendar', 'Calendar'); }
Class
2
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
Base
1
public function deleteUser(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $uid = I("uid/d"); if (D("Item")->where("uid = '$uid' and is_del = 0 ")->find()) { $this->sendError(10101,"该用户名下还有项目,不允许删除。请先将其项目删除或者重新分配/转让"); return ; } $re...
Compound
4
public static function newFromStyle( $style, \DPL\Parameters $parameters ) { $style = strtolower( $style ); switch ( $style ) { case 'definition': $class = 'DefinitionHeading'; break; case 'h1': case 'h2': case 'h3': case 'h4': case 'h5': case 'h6': case 'header': $class = 'Tier...
Class
2
public static function checkIp6($requestIp, $ip) { if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) { throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); } if (false !== strpos($ip...
Base
1
static function isSearchable() { return true; }
Base
1
public function uniqueName($dir, $name, $suffix = ' copy', $checkNum = true, $start = 1) { $ext = ''; if (preg_match('/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/i', $name, $m)) { $ext = '.'.$m[1]; $name = substr($name, 0, strlen($name)-strlen($m[0])); } if ($checkN...
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 static function dropdown($vars){ if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE "; if(isset($vars['type'])) { $where .= " `type` = '{$vars['type']}' AND "; }else{ $where .= " "; ...
Base
1
function mso_current_url($absolute = false, $explode = false, $delete_request = false) { $url = getinfo('site_protocol') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; if ($delete_request) { // отделим по «?» $url = explode('?', $url); $url = $url[0]; } if ($absolute) return $url; $url = s...
Base
1
function mso_url_get() { $CI = &get_instance(); if (isset($_SERVER['REQUEST_URI']) and $_SERVER['REQUEST_URI'] and (strpos($_SERVER['REQUEST_URI'], '?') !== FALSE)) { $url = getinfo('site_protocol') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $url = str_replace($CI->config->config['base_url'], "", $ur...
Base
1
function edit_freeform() { $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
function showallSubcategories() { // global $db; expHistory::set('viewable', $this->params); // $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid'); $catid = expSession::get('catid'); $parent = !empty($catid) ? $catid : (!empty($this->params...
Class
2
$pfTaskJob->update($input); $tasks_id = $data['plugin_glpiinventory_tasks_id']; } } else { // case 2: if not exist, create a new task + taskjob $this->getFromDB($packages_id); //Add the new task $input = [ 'na...
Base
1
function dashboard_panel_top_pages($params) { global $DB; global $website; $stats = &$params['statistics']; $navibars = &$params['navibars']; /* TOP PAGES */ $sql = ' SELECT i.views as page_views, i.id as id_item, i.category as id_category, p.views as path_views, p.path as path ...
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...
Base
1
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-",...
Base
1
elseif ( $columns['TITLE'] ) { $id_new = DBSeqNextID( 'school_marking_periods_marking_period_id_seq' ); $sql = "INSERT INTO SCHOOL_MARKING_PERIODS "; $fields = "MARKING_PERIOD_ID,MP,SYEAR,SCHOOL_ID,"; $values = "'" . $id_new . "','" . $_REQUEST['mp_term'] . "','" . UserSyear() . "','" . UserSchool() ...
Base
1
public function __construct() { # code... self::$smtphost = Options::v('smtphost'); self::$smtpuser = Options::v('smtpuser'); self::$smtppass = Options::v('smtppass'); self::$smtpport = Options::v('smtpport'); self::$siteemail = Options::v('si...
Base
1
$count += $db->dropTable($basename); } flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.'); expHistory::back(); }
Class
2
public function getPath() { return $this->path == null ? '' : $this->path; }
Base
1
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...
Base
1
foreach ($aco_value_array as $aco_value) { $this->debug_text("shift_acl(): ACO Section Value: $aco_section_value ACO VALUE: $aco_value"); $aco_key = array_search($aco_value, $acl_array['aco'][$aco_section_value]); if ($aco_key !== FALSE) { $this->debug_text("shift_acl(): Removing ACO. ($aco_ke...
Class
2
public function edit() { if((isset($this->params['id']))) $record = new address(intval($this->params['id'])); else $record = null; $config = ecomconfig::getConfig('address_allow_admins_all'); assign_to_template(array( 'record'=>$record, 'admin_config'=>$co...
Class
2