code
stringlengths
12
2.05k
label_name
stringclasses
5 values
label
int64
0
4
public function getQuerySelect() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; $R3 = 'R3_' . $this->field->id; return "$R2.id AS `" . $this->field->name . "`"; }
Base
1
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
Base
1
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; }
Base
1
private function isWindows() { return DIRECTORY_SEPARATOR !== '/'; }
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 __construct(public Request $Request, public SessionInterface $Session, public Config $Config, public Logger $Log, public Csrf $Csrf) { $flashBag = $this->Session->getBag('flashes'); // add type check because SessionBagInterface doesn't have get(), only FlashBag has it if ($flashBag instanceof FlashBag) { $this->ok = $flashBag->get('ok'); $this->ko = $flashBag->get('ko'); $this->warning = $flashBag->get('warning'); } $this->Log->pushHandler(new ErrorLogHandler()); $this->Users = new Users(); $this->Db = Db::getConnection(); // UPDATE SQL SCHEMA if necessary or show error message if version mismatch $Update = new Update($this->Config, new Sql()); $Update->checkSchema(); }
Base
1
function searchByModelForm() { // get the search terms $terms = $this->params['search_string']; $sql = "model like '%" . $terms . "%'"; $limit = !empty($this->config['limit']) ? $this->config['limit'] : 10; $page = new expPaginator(array( 'model' => 'product', 'where' => $sql, 'limit' => !empty($this->config['pagination_default']) ? $this->config['pagination_default'] : $limit, 'order' => 'title', 'dir' => 'DESC', 'page' => (isset($this->params['page']) ? $this->params['page'] : 1), 'controller' => $this->params['controller'], 'action' => $this->params['action'], 'columns' => array( gt('Model #') => 'model', gt('Product Name') => 'title', gt('Price') => 'base_price' ), )); assign_to_template(array( 'page' => $page, 'terms' => $terms )); }
Class
2
public function isAuthorizedBackendUserSession() { if (!$this->hasSessionCookie()) { return false; } $this->initializeSession(); if (empty($_SESSION['authorized']) || empty($_SESSION['isBackendSession'])) { return false; } return !$this->isExpired(); }
Base
1
protected function shouldRedirect(Request $request, Shop $shop) { return //for example: template preview, direct shop selection via url ( $request->isGet() && $request->getQuery('__shop') !== null && $request->getQuery('__shop') != $shop->getId() ) //for example: shop language switch || ( $request->isPost() && $request->getPost('__shop') !== null && $request->getPost('__redirect') !== null ) ; }
Base
1
protected function getFooService() { return $this->services['Bar\Foo'] = new \Bar\Foo(); }
Base
1
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); }
Base
1
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
Class
2
public function SendAndMail($from) { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called SendAndMail() without being connected"); return false; } fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); $rply = $this->get_lines(); $code = substr($rply,0,3); if($this->do_debug >= 2) { $this->edebug("SMTP -> FROM SERVER:" . $rply . $this->CRLF . '<br />'); } if($code != 250) { $this->error = array("error" => "SAML not accepted from server", "smtp_code" => $code, "smtp_msg" => substr($rply,4)); if($this->do_debug >= 1) { $this->edebug("SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF . '<br />'); } return false; } return true; }
Class
2
public function close() { $this->active = false; return (bool) $this->handler->close(); }
Base
1
public function manage_messages() { expHistory::set('manageable', $this->params); $page = new expPaginator(array( 'model'=>'order_status_messages', 'where'=>1, 'limit'=>10, 'order'=>'body', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); //eDebug($page); assign_to_template(array( 'page'=>$page )); }
Base
1
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
Base
1
public function handle($request, Closure $next) { $checkCart = cart_get_items_count(); if (!$checkCart) { //$shop_page = get_content('single=true&content_type=page&is_shop=1'); $shop_page = app()->content_repository->getFirstShopPage(); $redir = site_url(); if ($shop_page and isset($shop_page['id'])) { $link = content_link($shop_page['id']); if ($link) { $redir = $link; } } return redirect($redir); } $requiresRegistration = get_option('shop_require_registration', 'website') == '1'; if ($requiresRegistration and is_logged() == false) { return redirect(route('checkout.login')); } return $next($request); }
Base
1
private function filterQueryAndFragment($str) { return preg_replace_callback( '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $str ); }
Base
1
public function delete() { global $db, $history; /* 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']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login']; $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval']; $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification']; $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email']; if (empty($this->params['id'])) { flash('error', gt('Missing id for the comment you would like to delete')); $lastUrl = expHistory::getLast('editable'); } // delete the note $simplenote = new expSimpleNote($this->params['id']); $rows = $simplenote->delete(); // delete the assocication too $db->delete($simplenote->attachable_table, 'expsimplenote_id='.$this->params['id']); // send the user back where they came from. $lastUrl = expHistory::getLast('editable'); if (!empty($this->params['tab'])) { $lastUrl .= "#".$this->params['tab']; } redirect_to($lastUrl); }
Class
2
function init_args() { $_REQUEST=strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->req_spec_id = isset($_REQUEST['req_spec_id']) ? $_REQUEST['req_spec_id'] : 0; $args->doCompare = isset($_REQUEST['doCompare']) ? true : false; $args->left_item_id = isset($_REQUEST['left_item_id']) ? intval($_REQUEST['left_item_id']) : -1; $args->right_item_id = isset($_REQUEST['right_item_id']) ? intval($_REQUEST['right_item_id']) : -1; $args->tproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0; $args->useDaisyDiff = (isset($_REQUEST['diff_method']) && ($_REQUEST['diff_method'] == 'htmlCompare')) ? 1 : 0; $diffEngineCfg = config_get("diffEngine"); $args->context = null; if( !isset($_REQUEST['context_show_all'])) { $args->context = (isset($_REQUEST['context']) && is_numeric($_REQUEST['context'])) ? $_REQUEST['context'] : $diffEngineCfg->context; } return $args; }
Base
1
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
private function isFromTrustedProxy() { return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies); }
Base
1
function configure() { expHistory::set('editable', $this->params); // little bit of trickery so that that categories can have their own configs $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; $pullable_modules = expModules::listInstalledControllers($this->baseclassname, $this->loc); $views = expTemplate::get_config_templates($this, $this->loc); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all'); assign_to_template(array( 'config'=>$this->config, 'pullable_modules'=>$pullable_modules, 'views'=>$views, 'countries'=>$countries, 'regions'=>$regions, 'title'=>static::displayname() )); }
Base
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
Class
2
public static function DragnDropReRank2() { global $router, $db; $id = $router->params['id']; $page = new section($id); $old_rank = $page->rank; $old_parent = $page->parent; $new_rank = $router->params['position'] + 1; // rank $new_parent = intval($router->params['parent']); $db->decrement($page->tablename, 'rank', 1, 'rank>' . $old_rank . ' AND parent=' . $old_parent); // close in hole $db->increment($page->tablename, 'rank', 1, 'rank>=' . $new_rank . ' AND parent=' . $new_parent); // make room $params = array(); $params['parent'] = $new_parent; $params['rank'] = $new_rank; $page->update($params); self::checkForSectionalAdmins($id); expSession::clearAllUsersSessionCache('navigation'); }
Base
1
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ;
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'])) { $this->flash->success(t('Custom filter removed successfully.')); } else { $this->flash->failure(t('Unable to remove this custom filter.')); } $this->response->redirect($this->helper->url->to('CustomFilterController', 'index', array('project_id' => $project['id']))); }
Base
1
protected function _unlink($path) { return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime!="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows; }
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
$text = preg_replace( $skipPat, '', $text ); } if ( self::open( $parser, $part1 ) ) { //Handle recursion here, so we can break cycles. if ( $recursionCheck == false ) { $text = $parser->preprocess( $text, $parser->mTitle, $parser->mOptions ); self::close( $parser, $part1 ); } if ( $maxLength > 0 ) { $text = self::limitTranscludedText( $text, $maxLength, $link ); } if ( $trim ) { return trim( $text ); } else { return $text; } } else { return "[[" . $title->getPrefixedText() . "]]" . "<!-- WARNING: LST loop detected -->"; } }
Class
2
function edit_internalalias() { $section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params); if ($section->parent == -1) { notfoundController::handle_not_found(); exit; } // doesn't work for standalone pages if (empty($section->id)) { $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); }
Base
1
function updateProfile($data) { global $bigtree; foreach ($data as $key => $val) { if (substr($key,0,1) != "_" && !is_array($val)) { $$key = sqlescape($val); } } $id = sqlescape($this->ID); if ($data["password"]) { $phpass = new PasswordHash($bigtree["config"]["password_depth"], TRUE); $password = sqlescape($phpass->HashPassword($data["password"])); sqlquery("UPDATE bigtree_users SET `password` = '$password', `name` = '$name', `company` = '$company', `daily_digest` = '$daily_digest' WHERE id = '$id'"); } else { sqlquery("UPDATE bigtree_users SET `name` = '$name', `company` = '$company', `daily_digest` = '$daily_digest' WHERE id = '$id'"); } }
Base
1
$search_where = ['OR' => $ors];
Base
1
public function __get($var) { switch ($var) { case 'configuration_array': $this->configuration_array = array(); if ($this->configuration != ''){ $jsonData = json_decode($this->configuration,true); if ($jsonData !== null) { $this->configuration_array = $jsonData; } else { $this->configuration_array = array(); } } return $this->configuration_array; break; case 'name_support': return $this->name_support = $this->nick; break; case 'has_photo': return $this->filename != ''; break; case 'has_photo_avatar': return $this->filename != '' || $this->avatar != ''; break; case 'photo_path': $this->photo_path = ($this->filepath != '' ? '//' . $_SERVER['HTTP_HOST'] . erLhcoreClassSystem::instance()->wwwDir() : erLhcoreClassSystem::instance()->wwwImagesDir() ) .'/'. $this->filepath . $this->filename; return $this->photo_path; break; case 'file_path_server': return $this->filepath . $this->filename; break; default: break; } }
Class
2
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
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->id); //eDebug($product_type); $tpl = $product_type->getForm('show'); if (!empty($tpl)) $template = new controllertemplate($this, $tpl); //eDebug($template); $this->grabConfig(); // grab the global config assign_to_template(array( 'config' => $this->config, 'product' => $product_type, 'last_category' => $order->lastcat )); }
Class
2
public static function fixName($name) { $name = preg_replace('/[^A-Za-z0-9\.]/','_',$name); if ($name[0] == '.') $name[0] = '_'; return $name; // return preg_replace('/[^A-Za-z0-9\.]/', '-', $name); }
Base
1
public function getQueryOrderby() { $uh = UserHelper::instance(); $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return "$R2.ugroup_id"; }
Base
1
public function actionGetItems($modelType){ $sql = 'SELECT id, name as value FROM x2_campaigns 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 showall() { global $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 ($sectionObj->parent == -1) { $current = $sectionObj; } else { foreach ($navsections as $section) { if ($section->id == $id) { $current = $section; break; } } } assign_to_template(array( 'sections' => $navsections, 'current' => $current, 'canManage' => ((isset($user->is_acting_admin) && $user->is_acting_admin == 1) ? 1 : 0), )); }
Base
1
private function validateImageMetadata($data) { if (\is_array($data)) { foreach ($data as $value) { if (!$this->validateImageMetadata($value)) { return false; } } } else { if (1 === preg_match('/(<\?php?(.*?))/i', $data) || false !== stripos($data, '<?=') || false !== stripos($data, '<? ')) { return false; } } return true; }
Base
1
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webuser_groups WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); return $out; }
Base
1
protected function _save($fp, $dir, $name, $stat) { //TODO optionally encrypt $fp before uploading if mime is not already encrypted type $path = $this->_joinPath($dir, $name); return $this->connect->put($path, $fp) ? $path : false; }
Base
1
public function showall() { expHistory::set('viewable', $this->params); $hv = new help_version(); //$current_version = $hv->find('first', 'is_current=1'); $ref_version = $hv->find('first', 'version=\''.$this->help_version.'\''); // pagination parameter..hard coded for now. $where = $this->aggregateWhereClause(); $where .= 'AND help_version_id='.(empty($ref_version->id)?'0':$ref_version->id);
Base
1
public function getDisplayName ($plural=true) { return Yii::t('marketing', 'Web Form'); }
Class
2
} elseif ( $rowSize > 0 ) { // repeat row header after n lines of output $nstart = 0; $nsize = $rowSize; $count = count( $articles ); $output .= '{|' . $rowColFormat . "\n|\n"; do { if ( $nstart + $nsize > $count ) { $nsize = $count - $nstart; } $output .= $lister->formatList( $articles, $nstart, $nsize ); $output .= "\n|-\n|\n"; $nstart = $nstart + $nsize; if ( $nstart >= $count ) { break; } } while ( true ); $output .= "\n|}\n"; } else {
Class
2
public function __construct() { $this->options['alias'] = ''; // alias to replace root dir name $this->options['dirMode'] = 0755; // new dirs mode $this->options['fileMode'] = 0644; // new files mode $this->options['quarantine'] = '.quarantine'; // quarantine folder name - required to check archive (must be hidden) $this->options['rootCssClass'] = 'elfinder-navbar-root-local'; $this->options['followSymLinks'] = true; $this->options['detectDirIcon'] = ''; // file name that is detected as a folder icon e.g. '.diricon.png' $this->options['keepTimestamp'] = array('copy', 'move'); // keep timestamp at inner filesystem allowed 'copy', 'move' and 'upload' $this->options['substituteImg'] = true; // support substitute image with dim command $this->options['statCorrector'] = null; // callable to correct stat data `function(&$stat, $path, $statOwner, $volumeDriveInstance){}` }
Base
1
static function displayname() { return "Events"; }
Base
1
public function approve_submit() { if (empty($this->params['id'])) { flash('error', gt('No ID supplied for comment to approve')); expHistory::back(); } /* 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']; $comment = new expComment($this->params['id']); $comment->body = $this->params['body']; $comment->approved = $this->params['approved']; $comment->save(); expHistory::back(); }
Class
2
public static function avatar($id){ $usr = Db::result( sprintf("SELECT * FROM `user_detail` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1", Typo::int($id), Typo::cleanX($id) ) ); return $usr[0]->avatar; }
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) { $connection->query("ROLLBACK"); die(db_show_error($sql, _dbExecuteFailed, mysql_error())); } } } } else { $result = $connection->query($sql) or die(db_show_error($sql, _dbExecuteFailed, mysql_error())); } break; }
Base
1
public function myaddressbook() { global $user; // check if the user is logged in. expQueue::flashIfNotLoggedIn('message',gt('You must be logged in to manage your address book.')); if (!$user->isAdmin() && $this->params['user_id'] != $user->id) { unset($this->params['user_id']); } expHistory::set('viewable', $this->params); $userid = (empty($this->params['user_id'])) ? $user->id : $this->params['user_id']; assign_to_template(array( 'addresses'=>$this->address->find('all', 'user_id='.$userid) )); }
Class
2
protected function _fclose($fp, $path='') { return @fclose($fp); }
Base
1
public static function custom($vars) { $url = $vars; return $url; }
Base
1
public static function create( RequestInterface $request, ResponseInterface $response = null, \Exception $previous = null, array $ctx = [] ) { if (!$response) { return new self( 'Error completing request', $request, null, $previous, $ctx ); } $level = floor($response->getStatusCode() / 100); if ($level == '4') { $label = 'Client error'; $className = __NAMESPACE__ . '\\ClientException'; } elseif ($level == '5') { $label = 'Server error'; $className = __NAMESPACE__ . '\\ServerException'; } else { $label = 'Unsuccessful request'; $className = __CLASS__; } // Server Error: `GET /` resulted in a `404 Not Found` response: // <html> ... (truncated) $message = sprintf( '%s: `%s` resulted in a `%s` response', $label, $request->getMethod() . ' ' . $request->getUri(), $response->getStatusCode() . ' ' . $response->getReasonPhrase() ); $summary = static::getResponseBodySummary($response); if ($summary !== null) { $message .= ":\n{$summary}\n"; } return new $className($message, $request, $response, $previous, $ctx); }
Base
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Action removed successfully.')); } else { $this->flash->failure(t('Unable to remove this action.')); } $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id']))); }
Base
1
public function getQuerySelect() { // SubmittedOn is stored in the artifact return "a.submitted_on AS `" . $this->name . "`"; }
Base
1
public function Login ($username = '', $password = '') { if ($this->connected == false) { $this->error = 'Not connected to POP3 server'; if ($this->do_debug >= 1) { $this->displayErrors(); } } if (empty($username)) { $username = $this->username; } if (empty($password)) { $password = $this->password; } $pop_username = "USER $username" . $this->CRLF; $pop_password = "PASS $password" . $this->CRLF; // Send the Username $this->sendString($pop_username); $pop3_response = $this->getResponse(); if ($this->checkResponse($pop3_response)) { // Send the Password $this->sendString($pop_password); $pop3_response = $this->getResponse(); if ($this->checkResponse($pop3_response)) { return true; } } return false; }
Base
1
public function newpassword() { if ($token = $this->param('token')) { $user = $this->app->storage->findOne('cockpit/accounts', ['_reset_token' => $token]); if (!$user) { return false; } $user['md5email'] = md5($user['email']); return $this->render('cockpit:views/layouts/newpassword.php', compact('user', 'token')); } return false; }
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 version you are trying to delete could not be found')); } // if we have errors than lets get outta here! if (!expQueue::isQueueEmpty('error')) expHistory::back(); // delete the version $version->delete(); expSession::un_set('help-version'); flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.')); expHistory::back(); }
Base
1
public function loginForm( WebRequest $request ) { // Step 13 $out = $this->getOutput(); $username = $request->getVal('username'); $codes = SOA2Login::codes( $username ); $out->addHTML(Html::openElement('form', [ 'method' => 'POST' ])); $out->addHTML(Html::hidden('username', $username)); $out->addHTML(Html::hidden('token', $codes['csrf'])); // Step 14 $profile = Html::element( 'a', [ 'href' => sprintf(SOA2_PROFILE_URL, urlencode($username)), 'target' => '_new' ], wfMessage('soa2-your-profile')->plain() ); // Step 16 $out->addHTML(Html::rawElement( 'p', [], wfMessage('soa2-vercode-explanation')->rawParams($profile)->parse() )); $out->addHTML(Html::rawElement('p', [], Html::element( 'code', [], $codes['code'] ))); $out->addHTML(Html::rawElement('p', [], Html::submitButton( wfMessage('soa2-login')->plain(), [] ))); $out->addHTML(Html::closeElement('form')); }
Class
2
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
Base
1
public function shouldRun(DateTime $date) { global $timedate; $runDate = clone $date; $this->handleTimeZone($runDate); $cron = Cron\CronExpression::factory($this->schedule); if (empty($this->last_run) && $cron->isDue($runDate)) { return true; } $lastRun = $this->last_run ? $timedate->fromDb($this->last_run) : $timedate->fromDb($this->date_entered); $this->handleTimeZone($lastRun); $next = $cron->getNextRunDate($lastRun); return $next <= $runDate; }
Class
2
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
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
function wp_validate_redirect($location, $default = '') { $location = trim( $location ); // browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//' if ( substr($location, 0, 2) == '//' ) $location = 'http:' . $location; // In php 5 parse_url may fail if the URL query part contains http://, bug #38143 $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location; // @-operator is used to prevent possible warnings in PHP < 5.3.3. $lp = @parse_url($test); // Give up if malformed URL if ( false === $lp ) return $default; // Allow only http and https schemes. No data:, etc. if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) ) return $default; // Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field. if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) { return $default; } // Reject malformed components parse_url() can return on odd inputs. foreach ( array( 'user', 'pass', 'host' ) as $component ) { if ( isset( $lp[ $component ] ) && strpbrk( $lp[ $component ], ':/?#@' ) ) { return $default; } } $wpp = parse_url(home_url()); /** * Filters the whitelist of hosts to redirect to. * * @since 2.3.0 * * @param array $hosts An array of allowed hosts. * @param bool|string $host The parsed host; empty if not isset. */ $allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' ); if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) ) $location = $default; return $location; }
Class
2
public function testConvertsRequestsToStrings() { $request = new Psr7\Request('PUT', 'http://foo.com/hi?123', [ 'Baz' => 'bar', 'Qux' => ' ipsum' ], 'hello', '1.0'); $this->assertEquals( "PUT /hi?123 HTTP/1.0\r\nHost: foo.com\r\nBaz: bar\r\nQux: ipsum\r\n\r\nhello", Psr7\str($request) ); }
Base
1
$section = new section($this->params); } else { notfoundController::handle_not_found(); exit; } if (!empty($section->id)) { $check_id = $section->id; } else { $check_id = $section->parent; } if (expPermissions::check('manage', expCore::makeLocation('navigation', '', $check_id))) { if (empty($section->id)) { $section->active = 1; $section->public = 1; if (!isset($section->parent)) { // This is another precaution. The parent attribute // should ALWAYS be set by the caller. //FJD - if that's the case, then we should die. notfoundController::handle_not_authorized(); exit; //$section->parent = 0; } } assign_to_template(array( 'section' => $section, 'glyphs' => self::get_glyphs(), )); } else { // User does not have permission to manage sections. Throw a 403 notfoundController::handle_not_authorized(); } }
Base
1
function fread($handle, $length) { if (\yiiunit\framework\base\SecurityTest::$fread !== null) { return \yiiunit\framework\base\SecurityTest::$fread; } if (\yiiunit\framework\base\SecurityTest::$fopen !== null) { return $length < 8 ? \str_repeat('s', $length) : 'test1234'; } return \fread($handle, $length); }
Class
2
function showAddBypassForm() { $output = $this->pageContext->getOutput(); $request = $this->pageContext->getRequest(); $output->addHTML( new OOUI\FormLayout([ 'action' => SpecialPage::getTitleFor('ConfirmAccounts', wfMessage('scratch-confirmaccount-requirements-bypasses-url')->text())->getFullURL(), 'method' => 'post', 'items' => [ new OOUI\ActionFieldLayout( new OOUI\TextInputWidget( [ 'name' => 'bypassAddUsername', 'required' => true, 'value' => $request->getText('username') ] ), new OOUI\ButtonInputWidget([ 'type' => 'submit', 'flags' => ['primary', 'progressive'], 'label' => wfMessage('scratch-confirmaccount-requirements-bypasses-add')->parse() ]) ) ], ]) ); }
Compound
4
function get_allowed_files_extensions_for_upload($fileTypes = 'images', $returnAsArray = false) { $are_allowed = ''; switch ($fileTypes) { case 'img': case 'image': case 'images': $are_allowed .= ',png,gif,jpg,jpeg,tiff,bmp,svg,webp,ico'; break; case 'audio': case 'audios': $are_allowed .= ',mp3,mp4,ogg,wav,flac'; break; case 'video': case 'videos': $are_allowed .= ',avi,asf,mpg,mpeg,mp4,flv,mkv,webm,ogg,ogv,3gp,3g2,wma,mov,wmv'; break; case 'file': case 'files': $are_allowed .= ',css,json,zip,gzip,csv,7z'; break; case 'documents': case 'doc': $are_allowed .= ',doc,docx,pdf,odt,pages,rtf,txt,pps,ppt,pptx,xls,xlsx'; break; case 'archives': case 'arc': case 'arch': $are_allowed .= ',zip,zipx,gzip,rar,gz,7z,cbr,tar.gz'; break; case 'all': $are_allowed .= ',*'; break; case '*': $are_allowed .= ',*'; break; default: $are_allowed .= ',' . $fileTypes; } if($are_allowed){ $are_allowed = explode(',',$are_allowed); array_unique($are_allowed); $are_allowed = array_filter($are_allowed); if ($returnAsArray) { return $are_allowed; } $are_allowed = implode(',', $are_allowed); } if ($returnAsArray) { return []; } return $are_allowed; }
Base
1
return $fa->nameGlyph($icons, 'icon-'); } } else { return array(); } }
Base
1
$section = new section(intval($page)); if ($section) { // self::deleteLevel($section->id); $section->delete(); } } }
Base
1
public function rules() { $rules = [ 'username' => 'required|unique:users,username', 'email' => 'unique:users,email', ]; return $rules; }
Base
1
function commit_criteria_list_to_query($criteria_list) { $criteria_list = str_replace('>', ' ASC', $criteria_list); $criteria_list = str_replace('<', ' DESC', $criteria_list); return $criteria_list; }
Base
1
$post = Db::query("UPDATE `options` SET `value`='{$v}' WHERE `name` = '{$k}' LIMIT 1"); } }else{ $post = Db::query("UPDATE `options` SET `value`='{$val}' WHERE `name` = '{$key}' LIMIT 1"); } return $post; }
Base
1
public function getQuerySelect() { //Last update date is stored in the changeset (the date of the changeset) return "c.submitted_on AS `" . $this->name . "`"; }
Base
1
public function __construct( CartService $cartService, SalesChannelRepositoryInterface $productRepository, PromotionItemBuilder $promotionItemBuilder, ProductLineItemFactory $productLineItemFactory ) { $this->cartService = $cartService; $this->productRepository = $productRepository; $this->promotionItemBuilder = $promotionItemBuilder; $this->productLineItemFactory = $productLineItemFactory; }
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 getQueryGroupby() { // SubmittedOn is stored in the artifact return 'a.submitted_by'; }
Base
1
return $fa->nameGlyph($icons, 'icon-'); } } else { return array(); } }
Base
1
$keys = array_keys($value); // print_r($keys); if ($keys[0] == $lang) { $lang = $multilang[$key][$lang]; return $lang; } } } }
Base
1
. htmlspecialchars($table['table']) . '`</a>'; $html .= '</li>'; } } } else { $html .= '<li class="warp_link">' . ($this->_tableType == 'recent' ?__('There are no recent tables.') :__('There are no favorite tables.')) . '</li>'; }
Base
1
function import() { $pullable_modules = expModules::listInstalledControllers($this->baseclassname); $modules = new expPaginator(array( 'records' => $pullable_modules, 'controller' => $this->loc->mod, 'action' => $this->params['action'], 'order' => isset($this->params['order']) ? $this->params['order'] : 'section', 'dir' => isset($this->params['dir']) ? $this->params['dir'] : '', 'page' => (isset($this->params['page']) ? $this->params['page'] : 1), 'columns' => array( gt('Title') => 'title', gt('Page') => 'section' ), )); assign_to_template(array( 'modules' => $modules, )); }
Class
2
public static function getHelpVersionId($version) { global $db; return $db->selectValue('help_version', 'id', 'version="'.$version.'"'); }
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 reparent_standalone() { $standalone = $this->section->find($this->params['page']); if ($standalone) { $standalone->parent = $this->params['parent']; $standalone->update(); expSession::clearAllUsersSessionCache('navigation'); expHistory::back(); } else { notfoundController::handle_not_found(); } }
Base
1
public function getLayout(){ $layout = $this->getAttribute('layout'); $initLayout = $this->initLayout(); if(!$layout){ // layout hasn't been initialized? $layout = $initLayout; $this->layout = json_encode($layout); $this->update(array('layout')); }else{ $layout = json_decode($layout, true); // json to associative array $this->addRemoveLayoutElements('center', $layout, $initLayout); $this->addRemoveLayoutElements('left', $layout, $initLayout); $this->addRemoveLayoutElements('right', $layout, $initLayout); } return $layout; }
Base
1
private function applyParts(array $parts) { $this->scheme = isset($parts['scheme']) ? $this->filterScheme($parts['scheme']) : ''; $this->userInfo = isset($parts['user']) ? $parts['user'] : ''; $this->host = isset($parts['host']) ? $parts['host'] : ''; $this->port = !empty($parts['port']) ? $this->filterPort($this->scheme, $this->host, $parts['port']) : null; $this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : ''; $this->query = isset($parts['query']) ? $this->filterQueryAndFragment($parts['query']) : ''; $this->fragment = isset($parts['fragment']) ? $this->filterQueryAndFragment($parts['fragment']) : ''; if (isset($parts['pass'])) { $this->userInfo .= ':' . $parts['pass']; } }
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 manage_messages() { expHistory::set('manageable', $this->params); $page = new expPaginator(array( 'model'=>'order_status_messages', 'where'=>1, 'limit'=>10, 'order'=>'body', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->params['controller'], 'action'=>$this->params['action'], //'columns'=>array('Name'=>'title') )); //eDebug($page); assign_to_template(array( 'page'=>$page )); }
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 manage_versions() { expHistory::set('manageable', $this->params); $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); $sql = 'SELECT hv.*, COUNT(h.title) AS num_docs FROM '.DB_TABLE_PREFIX.'_help h '; $sql .= 'RIGHT JOIN '.DB_TABLE_PREFIX.'_help_version hv ON h.help_version_id=hv.id GROUP BY hv.version'; $page = new expPaginator(array( 'sql'=>$sql, 'limit'=>30, 'order' => (isset($this->params['order']) ? $this->params['order'] : 'version'), 'dir' => (isset($this->params['dir']) ? $this->params['dir'] : 'DESC'), 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), 'controller'=>$this->baseclassname, 'action'=>$this->params['action'], 'src'=>$this->loc->src, 'columns'=>array( gt('Version')=>'version', gt('Title')=>'title', gt('Current')=>'is_current', gt('# of Docs')=>'num_docs' ), )); assign_to_template(array( 'current_version'=>$current_version, 'page'=>$page )); }
Base
1
function getResourceGroupID($groupdname) { list($type, $name) = explode('/', $groupdname); $query = "SELECT g.id " . "FROM resourcegroup g, " . "resourcetype t " . "WHERE g.name = '$name' AND " . "t.name = '$type' AND " . "g.resourcetypeid = t.id"; $qh = doQuery($query, 371); if($row = mysql_fetch_row($qh)) return $row[0]; else return NULL; }
Class
2
foreach ($days as $value) { $regitem[] = $value; }
Class
2
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "addresses as a "; //R JOIN " . //$db->prefix . "billingmethods as bm ON bm.addresses_id=a.id "; $sql .= " WHERE match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) "; $sql .= "order by match (a.firstname,a.lastname,a.email,a.organization) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) ASC LIMIT 12"; $res = $db->selectObjectsBySql($sql); foreach ($res as $key=>$record) { $res[$key]->title = $record->firstname . ' ' . $record->lastname; } //eDebug($sql); $ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res); $ar->send(); }
Base
1
$loc = expCore::makeLocation('navigation', '', $standalone->id); if (expPermissions::check('manage', $loc)) return true; } return false; }
Class
2
public function settings_save() { AuthUser::load(); if (!AuthUser::isLoggedIn()) { redirect(get_url('login')); } else if (!AuthUser::hasPermission('admin_edit')) { Flash::set('error', __('You do not have permission to access the requested page!')); redirect(get_url()); } if (!isset($_POST['settings'])) { Flash::set('error', 'File Manager - ' . __('form was not posted.')); redirect(get_url('plugin/file_manager/settings')); } else { $settings = $_POST['settings']; if ($settings['umask'] == 0) $settings['umask'] = 0; elseif (!preg_match('/^0?[0-7]{3}$/', $settings['umask'])) $settings['umask'] = 0; if (strlen($settings['umask']) === 3) $settings['umask'] = '0' . $settings['umask']; elseif (strlen($settings['umask']) !== 4 && $settings['umask'] != 0) $settings['umask'] = 0; if (!preg_match('/^0?[0-7]{3}$/', $settings['dirmode'])) $settings['dirmode'] = '0755'; if (strlen($settings['dirmode']) === 3) $settings['dirmode'] = '0' . $settings['dirmode']; if (!preg_match('/^0?[0-7]{3}$/', $settings['filemode'])) $settings['filemode'] = '0755'; if (strlen($settings['filemode']) === 3) $settings['filemode'] = '0' . $settings['filemode']; } if (Plugin::setAllSettings($settings, 'file_manager')) Flash::setNow('success', 'File Manager - ' . __('plugin settings saved.')); else Flash::setNow('error', 'File Manager - ' . __('plugin settings not saved!')); $this->display('file_manager/views/settings', array('settings' => $settings)); }
Class
2
public function navigate_session() { global $website; global $user; global $DB; $fid = $_REQUEST['fid']; if(empty($fid)) $fid = 'dashboard'; $user_profile_name = $DB->query_single('name', 'nv_profiles', 'id='.protect($user->profile)); $this->add_content( '<div class="navigate-help">'. (empty($website->id)? '' : '<a class="navigate-plus-link" href="#" title="'.t(38, 'Create').'"><i class="fa fa-fw fa-plus"></i></span></a>'). //'<a class="navigate-favorites-link" href="#" title="'.t(465, 'Favorites').'"><i class="fa fa-fw fa-heart"></i></span></a>'. '<a class="navigate-help-link" title="'.t(302, 'Help').'" href="http://www.navigatecms.com/help?lang='.$user->language.'&fid='.$fid.'" target="_blank"><i class="fa fa-fw fa-question"></i></a>'. '<a class="navigate-logout-link" href="?logout" title="'.t(5, 'Logout').'"><i class="fa fa-fw fa-power-off"></i></span></a>'. '</div>'. '<div class="navigate-session">'. (empty($website->id)? '' : '<a href="#" id="navigate-recent-items-link"><div><span class="ui-icon ui-icon-triangle-1-s" style=" float: right; "></span><img src="img/icons/silk/briefcase.png" width="16px" height="16px" align="absmiddle" /> '.t(275, 'Recent items').'</div></a>').
Base
1
public function renameRemote($oldName, $newName) { $this->run('remote', 'rename', $oldName, $newName); return $this; }
Class
2