code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
private function _stablepages( $option ) { if ( function_exists( 'efLoadFlaggedRevs' ) ) { //Do not add this again if 'qualitypages' has already added it. if ( !$this->parametersProcessed['qualitypages'] ) { $this->addJoin( 'flaggedpages', [ "LEFT JOIN", "page_id = fp_page_id" ] ); } switch ( $option ) { case 'only': $this->addWhere( [ 'fp_stable IS NOT NULL' ] ); break; case 'exclude': $this->addWhere( [ 'fp_stable' => null ] ); break; } } }
Class
2
function scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); } return $ret; }
Class
2
private function _verify($public_key_or_secret, $expected_alg = null) { $segments = explode('.', $this->raw); $signature_base_string = implode('.', array($segments[0], $segments[1])); if (!$expected_alg) { # NOTE: might better to warn here $expected_alg = $this->header['alg']; } switch ($expected_alg) { case 'HS256': case 'HS384': case 'HS512': return $this->signature === hash_hmac($this->digest(), $signature_base_string, $public_key_or_secret, true); case 'RS256': case 'RS384': case 'RS512': return $this->rsa($public_key_or_secret, RSA::SIGNATURE_PKCS1)->verify($signature_base_string, $this->signature); case 'ES256': case 'ES384': case 'ES512': throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported'); case 'PS256': case 'PS384': case 'PS512': return $this->rsa($public_key_or_secret, RSA::SIGNATURE_PSS)->verify($signature_base_string, $this->signature); default: throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm'); } }
Class
2
public static function dropdown($vars) { if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE "; if(isset($vars['parent'])) { $where .= " `parent` = '{$vars['parent']}' "; }else{ $where .= "1 "; } $order_by = "ORDER BY "; if(isset($vars['order_by'])) { $order_by .= " {$vars['order_by']} "; }else{ $order_by .= " `name` "; } if (isset($vars['sort'])) { $sort = " {$vars['sort']}"; } } $cat = Db::result("SELECT * FROM `cat` {$where} {$order_by} {$sort}"); $drop = "<select name=\"{$name}\" class=\"form-control\"><option></option>"; if(Db::$num_rows > 0 ){ foreach ($cat as $c) { # code... if($c->parent == ''){ if(isset($vars['selected']) && $c->id == $vars['selected']) $sel = "SELECTED"; else $sel = ""; $drop .= "<option value=\"{$c->id}\" $sel style=\"padding-left: 10px;\">{$c->name}</option>"; foreach ($cat as $c2) { # code... if($c2->parent == $c->id){ if(isset($vars['selected']) && $c2->id == $vars['selected']) $sel = "SELECTED"; else $sel = ""; $drop .= "<option value=\"{$c2->id}\" $sel style=\"padding-left: 10px;\">&nbsp;&nbsp;&nbsp;{$c2->name}</option>"; } } } } } $drop .= "</select>"; return $drop; }
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 { $this->flash->failure(t('Unable to remove this column.')); } $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); }
Base
1
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); if ($tag['project_id'] != $project['id']) { throw new AccessForbiddenException(); } if ($valid) { if ($this->tagModel->update($values['id'], $values['name'])) { $this->flash->success(t('Tag updated successfully.')); } else { $this->flash->failure(t('Unable to update this tag.')); } $this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id']))); } else { $this->edit($values, $errors); } }
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_creation/event', array( 'values' => $values, 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
Base
1
public function logout() { if ($this->Session->check('Auth.User')) { $this->__extralog("logout"); } $this->Flash->info(__('Good-Bye')); $user = $this->User->find('first', array( 'conditions' => array( 'User.id' => $this->Auth->user('id') ), 'recursive' => -1 )); unset($user['User']['password']); $user['User']['action'] = 'logout'; $this->User->save($user['User'], true, array('id')); $this->redirect($this->Auth->logout()); }
Class
2
public function withUri(UriInterface $uri, $preserveHost = false) { if ($uri === $this->uri) { return $this; } $new = clone $this; $new->uri = $uri; if (!$preserveHost) { if ($host = $uri->getHost()) { $new->updateHostFromUri($host); } } return $new; }
Base
1
foreach ($events as $event) { $extevents[$date][] = $event; }
Base
1
function XMLRPCgetResourceGroupPrivs($name, $type, $nodeid){ require_once(".ht-inc/privileges.php"); global $user; if(! checkUserHasPriv("resourceGrant", $user['id'], $nodeid)){ return array('status' => 'error', 'errorcode' => 53, 'errormsg' => 'Unable to add resource group to this node'); } if($typeid = getResourceTypeID($type)){ if(!checkForGroupName($name, 'resource', '', $typeid)){ return array('status' => 'error', 'errorcode' => 28, 'errormsg' => 'resource group does not exist'); } $nodePrivileges = getNodePrivileges($nodeid, 'resources'); $nodePrivileges = getNodeCascadePrivileges($nodeid, 'resources', $nodePrivileges); foreach($nodePrivileges['resources'] as $resource => $privs){ if(strstr($resource, "$type/$name")){ return array( 'status' => 'success', 'privileges' => $privs); } } return array( 'status' => 'error', 'errorcode' => 29, 'errormsg' => 'could not find resource name in privilege list'); } else { return array('status' => 'error', 'errorcode' => 56, 'errormsg' => 'Invalid resource type'); } }
Class
2
}elseif($p->status == 1){ $status = "<a href=\"index.php?page=users&act=inactive&id={$p->id}&token=".TOKEN."\" class=\"label label-primary\">Active</a>"; }
Base
1
function phpAds_SessionDataFetch() { global $session; $dal = new MAX_Dal_Admin_Session(); // Guard clause: Can't fetch a session without an ID if (empty($_COOKIE['sessionID'])) { return; } $serialized_session = $dal->getSerializedSession($_COOKIE['sessionID']); // This is required because 'sessionID' cookie is set to new during logout. // According to comments in the file it is because some servers do not // support setting cookies during redirect. if (empty($serialized_session)) { return; } $loaded_session = unserialize($serialized_session); if (!$loaded_session) { // XXX: Consider raising an error return; } $session = $loaded_session; $dal->refreshSession($_COOKIE['sessionID']); }
Compound
4
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_converter/show', array( 'subtask' => $subtask, 'task' => $task, ))); }
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 $manage_all is moot w/ cascading perms now? $manage_all = false; if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $id))) { $manage_all = true; } //FIXME recode to use foreach $key=>$value $navcount = count($nav); for ($i = 0; $i < $navcount; $i++) { if ($manage_all || expPermissions::check('manage', expCore::makeLocation('navigation', '', $nav[$i]->id))) { $nav[$i]->manage = 1; $view = true; } else { $nav[$i]->manage = 0; $view = $nav[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $nav[$i]->id)); } $nav[$i]->link = expCore::makeLink(array('section' => $nav[$i]->id), '', $nav[$i]->sef_name); if (!$view) unset($nav[$i]); } $nav= array_values($nav); // $nav[$navcount - 1]->last = true; if (count($nav)) $nav[count($nav) - 1]->last = true; // echo expJavascript::ajaxReply(201, '', $nav); $ar = new expAjaxReply(201, '', $nav); $ar->send(); }
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, -1) == '=') { $value = ' IS NULL'; $string = substr($string, 0, -1); } $string .= "$value"; if ($counter == ($array_count - 2) && $array_count % 2 == 0) $string .= " ELSE "; elseif ($counter == ($array_count - 1)) $string .= " END "; elseif ($counter % 2 == 0) $string .= " WHEN $array[0]="; elseif ($counter % 2 == 1) $string .= " THEN "; $counter++; } } return $string; }
Base
1
function test_allowed_anon_comments() { add_filter( 'xmlrpc_allow_anonymous_comments', '__return_true' ); $comment_args = array( 1, '', '', self::$post->ID, array( 'author' => 'WordPress', 'author_email' => 'noreply@wordpress.org', 'content' => 'Test Anon Comments', ), ); $result = $this->myxmlrpcserver->wp_newComment( $comment_args ); $this->assertNotIXRError( $result ); $this->assertInternalType( 'int', $result ); }
Class
2
public static function generatePass(){ $vars = microtime().Site::$name.rand(); $hash = sha1($vars.SECURITY_KEY); $pass = substr($hash, 5, 8); return $pass; }
Base
1
public function createBranch($name, $checkout = FALSE) { // git branch $name $this->run('branch', $name); if ($checkout) { $this->checkout($name); } return $this; }
Class
2
function twig_array_filter(Environment $env, $array, $arrow) { if (!twig_test_iterable($array)) { throw new RuntimeError(sprintf('The "filter" filter expects an array or "Traversable", got "%s".', \is_object($array) ? \get_class($array) : \gettype($array))); } if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { throw new RuntimeError('The callable passed to "filter" filter must be a Closure in sandbox mode.'); } if (\is_array($array)) { return array_filter($array, $arrow, \ARRAY_FILTER_USE_BOTH); } // the IteratorIterator wrapping is needed as some internal PHP classes are \Traversable but do not implement \Iterator return new \CallbackFilterIterator(new \IteratorIterator($array), $arrow); }
Class
2
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
foreach ($this->_to_convert as $error) { $message = $this->getMessage($error['field'], $error['rule'], $error['fallback']); // If there is no generic `message()` set or the translated message is not equal to generic message // we can continue without worrying about duplications if ($this->_message === null || ($message != $this->_message && !in_array($message, $this->_errors))) { $this->_errors[] = $message; continue; } // If this new error is the generic message AND it has not already been added, add it if ($message == $this->_message && !in_array($this->_message, $this->_errors)) { $this->_errors[] = $this->_message; } }
Base
1
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
Base
1
public function configure() { $this->config['defaultbanner'] = array(); if (!empty($this->config['defaultbanner_id'])) { $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']); } parent::configure(); $banners = $this->banner->find('all', null, 'companies_id'); assign_to_template(array( 'banners'=>$banners, 'title'=>static::displayname() )); }
Class
2
static function cronCheckUpdate($task) { $result = Toolbox::checkNewVersionAvailable(1); $task->log($result); return 1; }
Compound
4
public function getFlashCookieObject($name) { if (isset($_COOKIE[$name])) { $object = json_decode($_COOKIE[$name], false); setcookie($name, '', time() - 3600, '/'); return $object; } return null; }
Base
1
foreach ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); }
Class
2
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->params['id'])) expQueue::flashAndFlow('error', gt('The subscriber id for account was not supplied.')); // verify the id/key pair $sub = new subscribers($this->params['id']); if (empty($sub->id)) expQueue::flashAndFlow('error', gt('We could not find any subscriptions matching the ID and Key you provided.')); // get this users subscriptions $subscriptions = $db->selectColumn('expeAlerts_subscribers', 'expeAlerts_id', 'subscribers_id='.$sub->id); // get a list of all available E-Alerts $ealerts = new expeAlerts(); assign_to_template(array( 'subscriber'=>$sub, 'subscriptions'=>$subscriptions, 'ealerts'=>$ealerts->find('all') )); }
Base
1
$row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=$id_parent"); if ($row_rub) { $row['id_rubrique'] = $row_rub['id_rubrique']; } } } } return $row; }
Base
1
public function saveUpdatedUpload(UploadedFile $uploadedFile, Attachment $attachment) { if (!$attachment->external) { $this->deleteFileInStorage($attachment); } $attachmentName = $uploadedFile->getClientOriginalName(); $attachmentPath = $this->putFileInStorage($uploadedFile); $attachment->name = $attachmentName; $attachment->path = $attachmentPath; $attachment->external = false; $attachment->extension = $uploadedFile->getClientOriginalExtension(); $attachment->save(); return $attachment; }
Base
1
public static function canView($section) { global $db; if ($section == null) { return false; } if ($section->public == 0) { // Not a public section. Check permissions. return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id)); } else { // Is public. check parents. if ($section->parent <= 0) { // Out of parents, and since we are still checking, we haven't hit a private section. return true; } else { $s = $db->selectObject('section', 'id=' . $section->parent); return self::canView($s); } } }
Class
2
$contents = ['form' => tep_draw_form('manufacturers', 'manufacturers.php', 'page=' . $_GET['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=save', 'post', 'enctype="multipart/form-data"')];
Base
1
public function actionGetItems(){ // We need to select the id both as 'id' and 'value' in order to correctly populate the association form. $sql = 'SELECT id, id as value FROM x2_services WHERE id LIKE :qterm ORDER BY id ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); exit; }
Class
2
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.')); } else { $this->flash->failure(t('Unable to update this swimlane.')); } $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id']))); }
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, -1) == '=') { $value = ' IS NULL'; $string = substr($string, 0, -1); } $string .= "$value"; if ($counter == ($array_count - 2) && $array_count % 2 == 0) $string .= " ELSE "; elseif ($counter == ($array_count - 1)) $string .= " END "; elseif ($counter % 2 == 0) $string .= " WHEN $array[0]="; elseif ($counter % 2 == 1) $string .= " THEN "; $counter++; } } return $string; }
Base
1
public function __construct() { }
Base
1
static function displayname() { return "Events"; }
Base
1
public function setRemoteUrl($name, $url, array $params = NULL) { $this->run('remote', 'set-url', $params, $name, $url); return $this; }
Class
2
$instance->schema = ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'};
Base
1
function remove() { global $db; $section = $db->selectObject('section', 'id=' . $this->params['id']); if ($section) { section::removeLevel($section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); $section->parent = -1; $db->updateObject($section, 'section'); expSession::clearAllUsersSessionCache('navigation'); expHistory::back(); } else { notfoundController::handle_not_authorized(); } }
Base
1
public function pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::getPendingBySubscriber($this->params['id']); $subscriber = new subscribers($this->params['id']); // render the template assign_to_template(array( 'subscriber'=>$subscriber, 'ealerts'=>$ealerts )); }
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']; $secteacher=$cp_det_RET['SECONDARY_TEACHER_ID']; $all_teacher=$teacher.($secteacher!=''?$secteacher:''); }
Base
1
public function anyData() { $tasks = Task::with(['user', 'status', 'client'])->select( collect(['external_id', 'title', 'created_at', 'deadline', 'user_assigned_id', 'status_id', 'client_id']) ->map(function ($field) { return (new Task())->qualifyColumn($field); }) ->all() ); return Datatables::of($tasks) ->addColumn('titlelink', '<a href="{{ route("tasks.show",[$external_id]) }}">{{$title}}</a>') ->editColumn('client', function ($projects) { return $projects->client->company_name; }) ->editColumn('created_at', function ($tasks) { return $tasks->created_at ? with(new Carbon($tasks->created_at)) ->format(carbonDate()) : ''; }) ->editColumn('deadline', function ($tasks) { return $tasks->created_at ? with(new Carbon($tasks->deadline)) ->format(carbonDate()) : ''; }) ->editColumn('user_assigned_id', function ($tasks) { return $tasks->user->name; }) ->editColumn('status_id', function ($tasks) { return '<span class="label label-success" style="background-color:' . $tasks->status->color . '"> ' . $tasks->status->title . '</span>'; }) ->addColumn('view', function ($tasks) { return '<a href="' . route("tasks.show", $tasks->external_id) . '" class="btn btn-link">' . __('View') .'</a>' . '<a data-toggle="modal" data-id="'. route('tasks.destroy',$tasks->external_id) . '" data-title="'. $tasks->title . '" data-target="#deletion" class="btn btn-link">' . __('Delete') .'</a>' ; }) ->rawColumns(['titlelink','view', 'status_id']) ->make(true); }
Base
1
public static function install ($var) { include(GX_PATH.'/gxadmin/themes/install/'.$var.'.php'); }
Base
1
function edit_option_master() { expHistory::set('editable', $this->params); $params = isset($this->params['id']) ? $this->params['id'] : $this->params; $record = new option_master($params); assign_to_template(array( 'record'=>$record )); }
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->flash->success(t('Your category have been created successfully.')); $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true); return; } else { $errors = array('name' => array(t('Another category with the same name exists in this project'))); } } $this->create($values, $errors); }
Base
1
function new_pass_form() { pagetop(gTxt('tab_site_admin'), ''); echo form( hed(gTxt('change_password'), 2). inputLabel( 'new_pass', fInput('password', 'new_pass', '', '', '', '', INPUT_REGULAR, '', 'new_pass'), 'new_password', '', array('class' => 'txp-form-field edit-admin-new-password') ). graf( checkbox('mail_password', '1', true, '', 'mail_password'). n.tag(gTxt('mail_it'), 'label', array('for' => 'mail_password')), array('class' => 'edit-admin-mail-password')). graf(fInput('submit', 'change_pass', gTxt('submit'), 'publish')). eInput('admin'). sInput('change_pass'), '', '', 'post', 'txp-edit', '', 'change_password'); }
Base
1
protected function _dirname($path) { return dirname($path); }
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->getId()) { throw new AccessForbiddenException(); } return $comment; }
Base
1
private function _notlinksto( $option ) { if ( $this->parameters->getParameter( 'distinct' ) == 'strict' ) { $this->addGroupBy( 'page_title' ); } if ( count( $option ) ) { $where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['pagelinks'] . '.pl_from FROM ' . $this->tableNames['pagelinks'] . ' WHERE '; $ors = []; foreach ( $option as $linkGroup ) { foreach ( $linkGroup as $link ) { $_or = '(' . $this->tableNames['pagelinks'] . '.pl_namespace=' . intval( $link->getNamespace() ); if ( strpos( $link->getDbKey(), '%' ) >= 0 ) { $operator = 'LIKE'; } else { $operator = '='; } if ( $this->parameters->getParameter( 'ignorecase' ) ) { $_or .= ' AND LOWER(CAST(' . $this->tableNames['pagelinks'] . '.pl_title AS char)) ' . $operator . ' LOWER(' . $this->DB->addQuotes( $link->getDbKey() ) . '))'; } else { $_or .= ' AND ' . $this->tableNames['pagelinks'] . '.pl_title ' . $operator . ' ' . $this->DB->addQuotes( $link->getDbKey() ) . ')'; } $ors[] = $_or; } } $where .= '(' . implode( ' OR ', $ors ) . '))'; } $this->addWhere( $where ); }
Class
2
public static function getStylesheet($styleName) { // Get custom stylesheet, of the default stylesheet if the custom stylesheet does not exist $stylesheet = get_option($styleName, ''); if (strlen($stylesheet) <= 0) { $stylesheetFile = SlideshowPluginMain::getPluginPath() . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'SlideshowPlugin' . DIRECTORY_SEPARATOR . $styleName . '.css'; if (!file_exists($stylesheetFile)) { $stylesheetFile = SlideshowPluginMain::getPluginPath() . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'SlideshowPlugin' . DIRECTORY_SEPARATOR . 'style-light.css'; } // Get contents of stylesheet ob_start(); include($stylesheetFile); $stylesheet .= ob_get_clean(); } // Replace the URL placeholders with actual URLs and add a unique identifier to separate stylesheets $stylesheet = str_replace('%plugin-url%', SlideshowPluginMain::getPluginUrl(), $stylesheet); $stylesheet = str_replace('%site-url%', get_bloginfo('url'), $stylesheet); $stylesheet = str_replace('%stylesheet-url%', get_stylesheet_directory_uri(), $stylesheet); $stylesheet = str_replace('%template-url%', get_template_directory_uri(), $stylesheet); $stylesheet = str_replace('.slideshow_container', '.slideshow_container_' . $styleName, $stylesheet); return $stylesheet; }
Class
2
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 { $this->flash->failure(t('Unable to remove this column.')); } $this->response->redirect($this->helper->url->to('ColumnController', 'index', array('project_id' => $project['id']))); }
Class
2
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; if (isset($this->config['only_featured'])) $where .= ' AND is_featured=1'; $page = new expPaginator(array( 'model'=>'news', 'where'=>$where, 'limit'=>25, 'order'=>'unpublish', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title', gt('Published On')=>'publish', gt('Status')=>'unpublish' ), )); assign_to_template(array( 'page'=>$page )); }
Base
1
public function testSetSaveHandler54() { $this->iniSet('session.save_handler', 'files'); $storage = $this->getStorage(); $storage->setSaveHandler(); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(null); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new SessionHandlerProxy(new NativeSessionHandler())); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new NativeSessionHandler()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new SessionHandlerProxy(new NullSessionHandler())); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); $storage->setSaveHandler(new NullSessionHandler()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy', $storage->getSaveHandler()); }
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
public function pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::getPendingBySubscriber($this->params['id']); $subscriber = new subscribers($this->params['id']); // render the template assign_to_template(array( 'subscriber'=>$subscriber, 'ealerts'=>$ealerts )); }
Base
1
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_templates WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $result = $command->queryAll(); echo CJSON::encode($result); exit; }
Base
1
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['category_id']) ?? $this->getDefaultCategoryId(); $array['enabled'] = ($array['enabled']) ?? 0; $array['default'] = ($array['default']) ?? 0; $array['type'] = ($array['type']) ?? 1; $array['order'] = ($array['order']) ?? $this->getNextTabOrder() + 1; if (array_key_exists('name', $array)) { $array['name'] = htmlspecialchars($array['name']); if ($this->isTabNameTaken($array['name'])) { $this->setAPIResponse('error', 'Tab name: ' . $array['name'] . ' is already taken', 409); return false; } } else { $this->setAPIResponse('error', 'Tab name was not supplied', 422); return false; } if (!array_key_exists('url', $array) && !array_key_exists('url_local', $array)) { $this->setAPIResponse('error', 'Tab url or url_local was not supplied', 422); return false; } if (!array_key_exists('image', $array)) { $this->setAPIResponse('error', 'Tab image was not supplied', 422); return false; } $response = [ array( 'function' => 'query', 'query' => array( 'INSERT INTO [tabs]', $array ) ), ]; $this->setAPIResponse(null, 'Tab added'); $this->setLoggerChannel('Tab Management'); $this->logger->debug('Added Tab for [' . $array['name'] . ']'); return $this->processQueries($response); }
Base
1
private function checkResponse ($string) { if (substr($string, 0, 3) !== '+OK') { $this->error = array( 'error' => "Server reported an error: $string", 'errno' => 0, 'errstr' => '' ); if ($this->do_debug >= 1) { $this->displayErrors(); } return false; } else { return true; } }
Base
1
public function delete() { global $user; $count = $this->address->find('count', 'user_id=' . $user->id); if($count > 1) { $address = new address($this->params['id']); if ($user->isAdmin() || ($user->id == $address->user_id)) { if ($address->is_billing) { $billAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id); $billAddress->is_billing = true; $billAddress->save(); } if ($address->is_shipping) { $shipAddress = $this->address->find('first', 'user_id=' . $user->id . " AND id != " . $address->id); $shipAddress->is_shipping = true; $shipAddress->save(); } parent::delete(); } } else { flash("error", gt("You must have at least one address.")); } expHistory::back(); }
Base
1
function insertObject($object, $table) { //if ($table=="text") eDebug($object,true); $sql = "INSERT INTO `" . $this->prefix . "$table` ("; $values = ") VALUES ("; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an '_' if ($var{0} != '_') { $sql .= "`$var`,"; if ($values != ") VALUES (") { $values .= ","; } $values .= "'" . $this->escapeString($val) . "'"; } } $sql = substr($sql, 0, -1) . substr($values, 0) . ")"; //if($table=='text')eDebug($sql,true); if (@mysqli_query($this->connection, $sql) != false) { $id = mysqli_insert_id($this->connection); return $id; } else return 0; }
Base
1
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
Class
2
protected function fsock_get_contents( &$url, $timeout, $redirect_max, $ua, $outfp ) { $connect_timeout = 3; $connect_try = 3; $method = 'GET'; $readsize = 4096; $getSize = null; $headers = ''; $arr = parse_url($url); if (!$arr){ // Bad request return false; } // query $arr['query'] = isset($arr['query']) ? '?'.$arr['query'] : ''; // port $arr['port'] = isset($arr['port']) ? $arr['port'] : (!empty($arr['https'])? 443 : 80); $url_base = $arr['scheme'].'://'.$arr['host'].':'.$arr['port']; $url_path = isset($arr['path']) ? $arr['path'] : '/'; $uri = $url_path.$arr['query']; $query = $method.' '.$uri." HTTP/1.0\r\n"; $query .= "Host: ".$arr['host']."\r\n"; if (!empty($ua)) $query .= "User-Agent: ".$ua."\r\n"; if (!is_null($getSize)) $query .= 'Range: bytes=0-' . ($getSize - 1) . "\r\n";
Base
1
private function updateModificationDate() { try { $modif_date = date('Y-m-d'); $update = $this->zdb->update(self::TABLE); $update->set( array('date_modif_adh' => $modif_date) )->where(self::PK . '=' . $this->_id); $edit = $this->zdb->execute($update); $this->_modification_date = $modif_date; } catch (Throwable $e) { Analog::log( 'Something went wrong updating modif date :\'( | ' . $e->getMessage() . "\n" . $e->getTraceAsString(), Analog::ERROR ); throw $e; } }
Base
1
static function author() { return "Dave Leffler"; }
Base
1
protected function parseRaw($raw, $base, $nameOnly = false) { $info = preg_split("/\s+/", $raw, 9); $stat = array(); if (!isset($this->ftpOsUnix)) { $this->ftpOsUnix = !preg_match('/\d/', substr($info[0], 0, 1)); } if (!$this->ftpOsUnix) { $info = $this->normalizeRawWindows($raw); } if (count($info) < 9 || $info[8] == '.' || $info[8] == '..') { return false; } $name = $info[8]; if (preg_match('|(.+)\-\>(.+)|', $name, $m)) { $name = trim($m[1]); // check recursive processing if ($this->cacheDirTarget && $this->_joinPath($base, $name) !== $this->cacheDirTarget) { return array(); } if (!$nameOnly) { $target = trim($m[2]); if (substr($target, 0, 1) !== $this->separator) { $target = $this->getFullPath($target, $base); } $target = $this->_normpath($target); $stat['name'] = $name; $stat['target'] = $target; return $stat; } } if ($nameOnly) { return array('name' => $name); } if (is_numeric($info[5]) && !$info[6] && !$info[7]) { // by normalizeRawWindows() $stat['ts'] = $info[5]; } else { $stat['ts'] = strtotime($info[5].' '.$info[6].' '.$info[7]); if (empty($stat['ts'])) { $stat['ts'] = strtotime($info[6].' '.$info[5].' '.$info[7]); } } $stat['owner'] = ''; if ($this->options['statOwner']) { $stat['owner'] = $info[2]; $stat['group'] = $info[3]; $stat['perm'] = substr($info[0], 1); $stat['isowner'] = $stat['owner']? ($stat['owner'] == $this->options['user']) : $this->options['owner']; } $perm = $this->parsePermissions($info[0], $stat['owner']); $stat['name'] = $name; $stat['mime'] = substr(strtolower($info[0]), 0, 1) == 'd' ? 'directory' : $this->mimetype($stat['name']); $stat['size'] = $stat['mime'] == 'directory' ? 0 : $info[4]; $stat['read'] = $perm['read']; $stat['write'] = $perm['write']; return $stat; }
Base
1
public static function incFunc($var) { if (self::functionExist($var)) { include(GX_THEME.$var.'/function.php'); } }
Base
1
protected function getItemsInHand($hashes, $dir = null) { static $totalSize = 0; if (is_null($dir)) { $totalSize = 0; if (! $tmpDir = $this->getTempPath()) { return false; } $dir = tempnam($tmpDir, 'elf'); if (!unlink($dir) || !mkdir($dir, 0700, true)) { return false; } register_shutdown_function(array($this, 'rmdirRecursive'), $dir); } $res = true; $files = array(); foreach ($hashes as $hash) { if (($file = $this->file($hash)) == false) { continue; } if (!$file['read']) { continue; } $name = $file['name']; // for call from search results if (isset($files[$name])) { $name = preg_replace('/^(.*?)(\..*)?$/', '$1_'.$files[$name]++.'$2', $name); } else { $files[$name] = 1; } $target = $dir.DIRECTORY_SEPARATOR.$name; if ($file['mime'] === 'directory') { $chashes = array(); $_files = $this->scandir($hash); foreach($_files as $_file) { if ($file['read']) { $chashes[] = $_file['hash']; } } if ($chashes) { mkdir($target, 0700, true); $res = $this->getItemsInHand($chashes, $target); } if (!$res) { break; } !empty($file['ts']) && @touch($target, $file['ts']); } else { $path = $this->decode($hash); if ($fp = $this->fopenCE($path)) { if ($tfp = fopen($target, 'wb')) { $totalSize += stream_copy_to_stream($fp, $tfp); fclose($tfp); } !empty($file['ts']) && @touch($target, $file['ts']); $this->fcloseCE($fp, $path); } if ($this->options['maxArcFilesSize'] > 0 && $this->options['maxArcFilesSize'] < $totalSize) { $res = $this->setError(elFinder::ERROR_ARC_MAXSIZE); } } } return $res? $dir : false; }
Base
1
public function destroy(PaymentMethod $paymentMethod) { $this->authorize('delete', $paymentMethod); $payments = $paymentMethod->payments; if ($payments->count() > 0) { return respondJson('payments_attached', 'Payments Attached.'); } $paymentMethod->delete(); return response()->json([ 'success' => 'Payment method deleted successfully', ]); }
Class
2
$this->headers = ['host' => [$host]] + $this->headers;
Base
1
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( $vendor->title, $vendor->table, $vendor->tablename, $vendor->classname, $vendor->identifier ); assign_to_template(array( 'vendor_title' => $vendor_title, 'vendor'=>$vendor )); } }
Base
1
function draw_cdef_preview($cdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>cdef=<?php print get_cdef($cdef_id, true);?></pre> </td> </tr> <?php }
Base
1
protected function moveVotes() { $sql = "SELECT * FROM package_proposal_votes WHERE pkg_prop_id = {$this->proposal}"; $res = $this->mdb2->query($sql); if (MDB2::isError($res)) { throw new RuntimeException("DB error occurred: {$res->getDebugInfo()}"); } if ($res->numRows() == 0) { return; // nothing to do } $insert = "INSERT INTO package_proposal_comments ("; $insert .= "user_handle, pkg_prop_id, timestamp, comment"; $insert .= ") VALUES(%s, {$this->proposal}, %d, %s)"; $delete = "DELETE FROM package_proposal_votes WHERE"; $delete .= " pkg_prop_id = {$this->proposal}"; $delete .= " AND user_handle = %s"; while ($row = $res->fetchRow(MDB2_FETCHMODE_OBJECT)) { $comment = "Original vote: {$row->value}\n"; $comment .= "Conditional vote: " . (($row->is_conditional != 0)?'yes':'no') . "\n"; $comment .= "Comment on vote: " . $row->comment . "\n"; $comment .= "Reviewed: " . implode(", ", unserialize($row->reviews)); $sql = sprintf( $insert, $this->mdb2->quote($row->user_handle), $row->timestamp, $this->mdb2->quote($comment) ); $this->queryChange($sql); $sql = sprintf( $delete, $this->mdb2->quote($row->user_handle) ); $this->queryChange($sql); }
Base
1
public function actionEditDropdown() { $model = new Dropdowns; if (isset($_POST['Dropdowns'])) { $model = Dropdowns::model()->findByPk( $_POST['Dropdowns']['id']); if ($model->id == Actions::COLORS_DROPDOWN_ID) { if (AuxLib::issetIsArray($_POST['Dropdowns']['values']) && AuxLib::issetIsArray($_POST['Dropdowns']['labels']) && count($_POST['Dropdowns']['values']) === count($_POST['Dropdowns']['labels'])) { if (AuxLib::issetIsArray($_POST['Admin']) && isset($_POST['Admin']['enableColorDropdownLegend'])) { Yii::app()->settings->enableColorDropdownLegend = $_POST['Admin']['enableColorDropdownLegend']; Yii::app()->settings->save(); } $options = array_combine( $_POST['Dropdowns']['values'], $_POST['Dropdowns']['labels']); $temp = array(); foreach ($options as $value => $label) { if ($value != "") $temp[$value] = $label; } $model->options = json_encode($temp); $model->save(); } } else { $model->attributes = $_POST['Dropdowns']; $temp = array(); if (is_array($model->options) && count($model->options) > 0) { foreach ($model->options as $option) { if ($option != "") $temp[$option] = $option; } $model->options = json_encode($temp); if ($model->save()) { } } } } $this->redirect( 'manageDropDowns' ); }
Class
2
function VerifyFixedSchedule($columns,$columns_var,$update=false) { $qr_teachers= DBGet(DBQuery('select TEACHER_ID,SECONDARY_TEACHER_ID from course_periods where course_period_id=\''.$_REQUEST['course_period_id'].'\'')); $teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']:$qr_teachers[1]['TEACHER_ID']); $secteacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']:$qr_teachers[1]['SECONDARY_TEACHER_ID']); // $secteacher=$qr_teachers[1]['SECONDARY_TEACHER_ID']; if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='') $all_teacher=$teacher.($secteacher!=''?','.$secteacher:'');
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_PREFIX.'_companies c , '.DB_TABLE_PREFIX.'_content_expFiles f '; $sql .= 'WHERE b.companies_id = c.id AND (b.id = f.content_id AND f.content_type="banner")'; $page = new expPaginator(array( 'model'=>'banner', 'sql'=>$sql, 'order'=>'title', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Title')=>'title', gt('Company')=>'companyname', gt('Impressions')=>'impressions', gt('Clicks')=>'clicks' ) )); assign_to_template(array( 'page'=>$page )); }
Base
1
public function display_sdm_stats_meta_box($post) { //Stats metabox $old_count = get_post_meta($post->ID, 'sdm_count_offset', true); $value = isset($old_count) && $old_count != '' ? $old_count : '0'; // Get checkbox for "disable download logging" $no_logs = get_post_meta($post->ID, 'sdm_item_no_log', true); $checked = isset($no_logs) && $no_logs === 'on' ? 'checked="checked"' : ''; _e('These are the statistics for this download item.', 'simple-download-monitor'); echo '<br /><br />'; global $wpdb; $wpdb->get_results($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'sdm_downloads WHERE post_id=%s', $post->ID)); echo '<div class="sdm-download-edit-dl-count">'; _e('Number of Downloads:', 'simple-download-monitor'); echo ' <strong>' . $wpdb->num_rows . '</strong>'; echo '</div>'; echo '<div class="sdm-download-edit-offset-count">'; _e('Offset Count: ', 'simple-download-monitor'); echo '<br />'; echo ' <input type="text" size="10" name="sdm_count_offset" value="' . $value . '" />'; echo '<p class="description">' . __('Enter any positive or negative numerical value; to offset the download count shown to the visitors (when using the download counter shortcode).', 'simple-download-monitor') . '</p>'; echo '</div>'; echo '<br />'; echo '<div class="sdm-download-edit-disable-logging">'; echo '<input type="checkbox" name="sdm_item_no_log" ' . $checked . ' />'; echo '<span style="margin-left: 5px;"></span>'; _e('Disable download logging for this item.', 'simple-download-monitor'); echo '</div>'; wp_nonce_field('sdm_count_offset_nonce', 'sdm_count_offset_nonce_check'); }
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 getQueryGroupby() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return "$R2.id"; }
Base
1
public function buildControl() { $control = new colorcontrol(); if (!empty($this->params['value'])) $control->value = $this->params['value']; if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value']; $control->default = $this->params['value']; if (!empty($this->params['hide'])) $control->hide = $this->params['hide']; if (isset($this->params['flip'])) $control->flip = $this->params['flip']; $this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : ''; $control->name = $this->params['name']; $this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : ''; $control->id = isset($this->params['id']) && $this->params['id'] != "" ? $this->params['id'] : ""; //echo $control->id; if (empty($control->id)) $control->id = $this->params['name']; if (empty($control->name)) $control->name = $this->params['id']; // attempt to translate the label if (!empty($this->params['label'])) { $this->params['label'] = gt($this->params['label']); } else { $this->params['label'] = null; } echo $control->toHTML($this->params['label'], $this->params['name']); // $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code))); // $ar->send(); }
Class
2
function test_anon_comments_require_email() { add_filter( 'xmlrpc_allow_anonymous_comments', '__return_true' ); $comment_args = array( 1, '', '', self::$post->ID, array( 'author' => 'WordPress', 'author_email' => 'noreply at wordpress.org', 'content' => 'Test Anon Comments', ), ); $result = $this->myxmlrpcserver->wp_newComment( $comment_args ); $this->assertIXRError( $result ); $this->assertSame( 403, $result->code ); }
Class
2
function parse_request($message) { $data = _parse_message($message); $matches = []; if (!preg_match('/^[a-zA-Z]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { throw new \InvalidArgumentException('Invalid request string'); } $parts = explode(' ', $data['start-line'], 3); $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; $request = new Request( $parts[0], $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1], $data['headers'], $data['body'], $version ); return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); }
Base
1
public function save() { $data = $_POST['file']; // security (remove all ..) $data['name'] = str_replace('..', '', $data['name']); $file = FILES_DIR . DS . $data['name']; // CSRF checks if (isset($_POST['csrf_token'])) { $csrf_token = $_POST['csrf_token']; if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/save/'.$data['name'])) { Flash::set('error', __('Invalid CSRF token found!')); redirect(get_url('plugin/file_manager/view/'.$data['name'])); } } else { Flash::set('error', __('No CSRF token found!')); redirect(get_url('plugin/file_manager/view/'.$data['name'])); } if (file_exists($file)) { if (file_put_contents($file, $data['content']) !== false) { Flash::set('success', __('File has been saved with success!')); } else { Flash::set('error', __('File is not writable! File has not been saved!')); } } else { if (file_put_contents($file, $data['content'])) { Flash::set('success', __('File :name has been created with success!', array(':name' => $data['name']))); } else { Flash::set('error', __('Directory is not writable! File has not been saved!')); } } // save and quit or save and continue editing ? if (isset($_POST['commit'])) { redirect(get_url('plugin/file_manager/browse/' . substr($data['name'], 0, strrpos($data['name'], '/')))); } else { redirect(get_url('plugin/file_manager/view/' . $data['name'] . (endsWith($data['name'], URL_SUFFIX) ? '?has_url_suffix=1' : ''))); }
Class
2
protected function generateVerifyCode() { if ($this->minLength > $this->maxLength) { $this->maxLength = $this->minLength; } if ($this->minLength < 3) { $this->minLength = 3; } if ($this->maxLength > 20) { $this->maxLength = 20; } $length = mt_rand($this->minLength, $this->maxLength); $letters = 'bcdfghjklmnpqrstvwxyz'; $vowels = 'aeiou'; $code = ''; for ($i = 0; $i < $length; ++$i) { if ($i % 2 && mt_rand(0, 10) > 2 || !($i % 2) && mt_rand(0, 10) > 9) { $code .= $vowels[mt_rand(0, 4)]; } else { $code .= $letters[mt_rand(0, 20)]; } } return $code; }
Class
2
protected function secure(Hostname $hostname, Request $request) { $this->emitEvent(new Secured($hostname)); return $this->redirect->secure($request->getRequestUri()); }
Base
1
function singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
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->flash->failure(t('Unable to remove this category.')); } $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id']))); }
Class
2
$db->insertObject($obj, 'expeAlerts_subscribers'); } $count = count($this->params['ealerts']); if ($count > 0) { flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.')); } else { flash('error', gt("You have been unsubscribed from all E-Alerts.")); } expHistory::back(); }
Class
2
function update_optiongroup_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $og = new optiongroup_master($id); $oldtitle = $og->title; $og->update($this->params); // if the title of the master changed we should update the option groups that are already using it. if ($oldtitle != $og->title) { $db->sql('UPDATE '.$db->prefix.'optiongroup SET title="'.$og->title.'" WHERE title="'.$oldtitle.'"'); } expHistory::back(); }
Base
1
protected function _tempdir($dir, $prefix = '', $mode = 0700) { if (substr($dir, -1) != DIRECTORY_SEPARATOR) { $dir .= DIRECTORY_SEPARATOR; } do { $path = $dir.$prefix.mt_rand(0, 9999999); } while (!mkdir($path, $mode)); return $path; }
Base
1
function mci_account_get_array_by_id( $p_user_id ) { $t_result = array(); $t_result['id'] = $p_user_id; if( user_exists( $p_user_id ) ) { $t_result['name'] = user_get_field( $p_user_id, 'username' ); $t_dummy = user_get_field( $p_user_id, 'realname' ); if( !empty( $t_dummy ) ) { $t_result['real_name'] = $t_dummy; } $t_dummy = user_get_field( $p_user_id, 'email' ); if( !empty( $t_dummy ) ) { $t_result['email'] = $t_dummy; } } return $t_result; }
Class
2
public function dispatch($messages, $final) { $targetErrors = []; foreach ($this->targets as $target) { if ($target->enabled) { try { $target->collect($messages, $final); } catch (\Exception $e) { $target->enabled = false; $targetErrors[] = [ 'Unable to send log via ' . get_class($target) . ': ' . ErrorHandler::convertExceptionToString($e), Logger::LEVEL_WARNING, __METHOD__, microtime(true), [], ]; } } } if (!empty($targetErrors)) { $this->dispatch($targetErrors, true); } }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_block_groups WHERE website = '.protect($website->id), 'object' ); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; }
Base
1
function manage () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); 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'); } assign_to_template(array( 'purchase_orders'=>$purchase_orders, 'vendors' => $vendors, 'vendor_id' => @$this->params['vendor'] )); }
Class
2
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_LOGIN : $this->params['require_login']; // $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval']; // $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification']; // $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('Missing id for the comment you would like to delete')); expHistory::back(); } // delete the comment $comment = new expComment($this->params['id']); $comment->delete(); // delete the association too $db->delete($comment->attachable_table, 'expcomments_id='.$this->params['id']); // send the user back where they came from. expHistory::back(); }
Class
2
function OA_runMPE() { $objResponse = new xajaxResponse(); $objResponse->addAssign("run-mpe", "innerHTML", "<img src='run-mpe.php' />"); return $objResponse; }
Compound
4
public function params() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) { $this->create(); return; } $action = $this->actionManager->getAction($values['action_name']); $action_params = $action->getActionRequiredParameters(); if (empty($action_params)) { $this->doCreation($project, $values + array('params' => array())); } $projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId()); unset($projects_list[$project['id']]); $this->response->html($this->template->render('action_creation/params', array( 'values' => $values, 'action_params' => $action_params, 'columns_list' => $this->columnModel->getList($project['id']), 'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']), 'projects_list' => $projects_list, 'colors_list' => $this->colorModel->getList(), 'categories_list' => $this->categoryModel->getList($project['id']), 'links_list' => $this->linkModel->getList(0, false), 'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project), 'project' => $project, 'available_actions' => $this->actionManager->getAvailableActions(), 'swimlane_list' => $this->swimlaneModel->getList($project['id']), 'events' => $this->actionManager->getCompatibleEvents($values['action_name']), ))); }
Base
1
public function load_from_resultset($rs) { global $DB; $main = $rs[0]; $this->id = $main->id; $this->codename = $main->codename; $this->icon = $main->icon; $this->lid = $main->lid; $this->notes = $main->notes; $this->enabled = $main->enabled; /* $DB->query('SELECT function_id FROM nv_menu_items WHERE menu_id = '.$this->id.' ORDER BY position ASC'); $this->functions = $DB->result('function_id'); */ $this->functions = json_decode($main->functions); if(empty($this->functions)) $this->functions = array(); }
Base
1
private function __construct($userinfo, $tid = - 1) { $this->userinfo = $userinfo; $this->tid = $tid; // initialize data array $this->initData(); // read data from database $this->readData(); }
Class
2
$file_link = explode(" ", trim($row['file']))[0]; // If the link has no "http://" in front, then add it if (substr(strtolower($file_link), 0, 4) !== 'http') { $file_link = 'http://' . $file_link; } echo '<td><a href="http://anonym.to/?' . $file_link . '" target="_blank"><img class="icon" src="images/warning.png"/>http://anonym.to/?' . $file_link . '</a></td>'; echo '<td><a href="include/play.php?f=' . $row['session'] . '" target="_blank"><img class="icon" src="images/play.ico"/>Play</a></td>'; echo '<td><a href="kippo-scanner.php?file_url=' . $file_link . '" target="_blank">Scan File</a></td>'; echo '</tr>'; $counter++; } //Close tbody and table element, it's ready. echo '</tbody></table>'; echo '<hr /><br />'; }
Base
1