本文整理汇总了PHP中AdminHandler类的典型用法代码示例。如果您正苦于以下问题:PHP AdminHandler类的具体用法?PHP AdminHandler怎么用?PHP AdminHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AdminHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->connection = getConnection();
$this->collectionHandler = new CollectionHandler($this->connection);
$this->collectionHandler->create('ArangoDB_PHP_TestSuite_IndexTestCollection');
$adminHandler = new AdminHandler($this->connection);
$version = $adminHandler->getServerVersion();
$this->hasSparseIndexes = version_compare($version, '2.5.0') >= 0;
$this->hasSelectivityEstimates = version_compare($version, '2.5.0') >= 0;
}
示例2: isCluster
function isCluster(Connection $connection)
{
static $isCluster = null;
if ($isCluster === null) {
$adminHandler = new AdminHandler($connection);
try {
$role = $adminHandler->getServerRole();
$isCluster = $role === 'COORDINATOR' || $role === 'DBSERVER';
} catch (\Exception $e) {
// maybe server version is too "old"
$isCluster = false;
}
}
return $isCluster;
}
示例3: index
/**
* Display site admin index page.
*/
function index()
{
AdminHandler::validate();
AdminHandler::setupTemplate();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('helpTopicId', 'site.index');
$templateMgr->display('admin/index.tpl');
}
示例4: setUp
public function setUp()
{
$this->connection = getConnection();
$this->collectionHandler = new CollectionHandler($this->connection);
// clean up first
try {
$this->collectionHandler->drop('ArangoDB_PHP_TestSuite_TestCollection');
} catch (\Exception $e) {
// don't bother us, if it's already deleted.
}
$this->collection = new Collection();
$this->collection->setName('ArangoDB_PHP_TestSuite_TestCollection');
$this->collectionHandler->add($this->collection);
$this->documentHandler = new DocumentHandler($this->connection);
$adminHandler = new AdminHandler($this->connection);
$version = preg_replace("/-[a-z0-9]+\$/", "", $adminHandler->getServerVersion());
$this->hasExportApi = version_compare($version, '2.6.0') >= 0;
}
示例5: AdminFunctionsHandler
/**
* Constructor
**/
function AdminFunctionsHandler()
{
parent::AdminHandler();
}
示例6: Response
return new Response('Unauthorized', 401);
}
$object = array('admin_id' => $admin_id, 'role_id' => $request->get('role_id'));
$handler = new AdminHandler();
$result = $handler->updateRole($object);
return new Response($result['message'], $result['status_code']);
});
// Update password
$app->POST('/admin/{admin_id}/password', function (Application $app, Request $request, $admin_id) {
if (!authenticate('user', $admin_id)) {
return new Response('Unauthorized', 401);
}
$object = array('admin_id' => $admin_id, 'password' => $request->get('password'));
$handler = new AdminHandler();
$result = $handler->updatePassword($object);
return new Response($result['message'], $result['status_code']);
});
// Delete admin
$app->DELETE('/admin/{admin_id}', function (Application $app, Request $request, $admin_id) {
if (!authenticate('1', null)) {
return new Response('Unauthorized', 401);
}
$handler = new AdminHandler();
$result = $handler->delete($admin_id);
return new Response($result['message'], $result['status_code']);
});
// optional geolocation in body
$app->GET('/businesses/{category}/{subcategory}', function (Application $app, Request $request, $subcategory) {
return new Response('How about implementing businessRepairSubcategoryGet as a GET method ?');
});
$app->run();
示例7: safepost
require_once 'common.php';
if ($CONF['configured'] !== true) {
print "Installation not yet configured; please edit config.inc.php or write your settings to config.local.php";
exit;
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$lang = safepost('lang');
$fUsername = trim(safepost('fUsername'));
$fPassword = safepost('fPassword');
if ($lang != check_language(0)) {
# only set cookie if language selection was changed
setcookie('lang', $lang, time() + 60 * 60 * 24 * 30);
# language cookie, lifetime 30 days
# (language preference cookie is processed even if username and/or password are invalid)
}
$h = new AdminHandler();
if ($h->login($fUsername, $fPassword)) {
session_regenerate_id();
$_SESSION['sessid'] = array();
$_SESSION['sessid']['roles'] = array();
$_SESSION['sessid']['roles'][] = 'admin';
$_SESSION['sessid']['username'] = $fUsername;
$_SESSION['PFA_token'] = md5(uniqid(rand(), true));
# they've logged in, so see if they are a domain admin, as well.
if (!$h->init($fUsername)) {
flash_error($PALANG['pLogin_failed']);
}
if (!$h->view()) {
flash_error($PALANG['pLogin_failed']);
}
$adminproperties = $h->result();
示例8: AdminLanguagesHandler
/**
* Constructor
*/
function AdminLanguagesHandler()
{
parent::AdminHandler();
}
示例9: AdminSettingsHandler
function AdminSettingsHandler()
{
parent::AdminHandler();
}
示例10: AdminPressHandler
function AdminPressHandler()
{
parent::AdminHandler();
}
示例11: error_reporting
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
require_once 'init.php';
checkInstalled($pollDb, $config);
$pollRepository = new DbPollRepository($pollDb, $config['database']['prefix']);
$requestRepository = new DefaultRequestRepository();
if ($config['admin']['type'] == 'default') {
$adminInteractor = new AdminInteractor($config['admin']);
} elseif (isset($config['admin']['interactor']) && $config['admin']['interactor'] instanceof AdminInteractorInterface) {
$adminInteractor = $config['admin']['interactor'];
}
$pollInteractor = new PollInteractor($pollRepository, $requestRepository);
$adminHandler = new AdminHandler($pollInteractor, $adminInteractor);
$indexHandler = new IndexHandler($pollInteractor);
if (!isset($_GET['c'])) {
$_GET['c'] = '';
}
if (!isset($_GET['a'])) {
$_GET['a'] = '';
}
switch ($_GET['c']) {
case 'admin':
$adminHandler->Route($_GET['a']);
break;
case 'index':
default:
$indexHandler->Route($_GET['a']);
break;
}
示例12: AdminFunctionsHandler
/**
* Constructor
*/
function AdminFunctionsHandler()
{
parent::AdminHandler();
$this->addRoleAssignment(array(ROLE_ID_SITE_ADMIN), array('systemInfo', 'editSystemConfig', 'saveSystemConfig', 'phpinfo', 'expireSessions', 'clearTemplateCache', 'clearDataCache', 'downloadScheduledTaskLogFile', 'clearScheduledTaskLogFiles'));
}
示例13: __construct
public function __construct()
{
self::$facets = array(_t('More than .. posts') => 'morethan', _t('Less than .. posts') => 'lessthan', _t('Order by') => 'orderby');
self::$facet_values = array('orderby' => array(_t('Publication date (descending)') => 'pubdate_desc', _t('Publication date (ascending)') => 'pubdate_asc', _t('Post count (descending)') => 'count_desc', _t('Post count (ascending)') => 'count_asc', _t('Alphabetical (descending)') => 'alphabetical_desc', _t('Alphabetical (ascending)') => 'alphabetical_asc'));
// We could avoid "translating" for sure, but it adds an additional layer of security, so we keep it
self::$orderby_translate = array('pubdate' => 'pubdate', 'count' => 'count', 'alphabetical' => 'term_display');
return parent::__construct();
}
示例14: __construct
public function __construct()
{
$self = $this;
FormUI::register('add_group', function (FormUI $form, $name) use($self) {
$form->set_settings(array('use_session_errors' => true));
$form->append(FormControlText::create('groupname')->add_validator('validate_required', _t('The group must have a name'))->add_validator('validate_groupname')->label(_t('Group Name'))->add_class('incontent')->set_template('control.label.outsideleft'));
$form->append(FormControlSubmit::create('newgroup')->set_caption('Add Group'));
$form->add_validator(array($self, 'validate_add_group'));
$form->on_success(array($self, 'do_add_group'));
});
parent::__construct();
}
示例15: __construct
public function __construct()
{
parent::__construct();
// Let's register the options page form so we can use it with ajax
$self = $this;
FormUI::register('admin_options', function ($form, $name, $extra_data) use($self) {
$option_items = array();
$timezones = \DateTimeZone::listIdentifiers();
$timezones = array_merge(array('' => ''), array_combine(array_values($timezones), array_values($timezones)));
$option_items[_t('Name & Tagline')] = array('title' => array('label' => _t('Site Name'), 'type' => 'text', 'helptext' => ''), 'tagline' => array('label' => _t('Site Tagline'), 'type' => 'text', 'helptext' => ''), 'about' => array('label' => _t('About'), 'type' => 'textarea', 'helptext' => ''));
$option_items[_t('Publishing')] = array('pagination' => array('label' => _t('Items per Page'), 'type' => 'text', 'helptext' => ''), 'atom_entries' => array('label' => _t('Entries to show in Atom feed'), 'type' => 'text', 'helptext' => ''), 'comments_require_id' => array('label' => _t('Require Comment Author Email'), 'type' => 'checkbox', 'helptext' => ''), 'spam_percentage' => array('label' => _t('Comment SPAM Threshold'), 'type' => 'text', 'helptext' => _t('The likelihood a comment is considered SPAM, in percent.')));
$option_items[_t('Time & Date')] = array('timezone' => array('label' => _t('Time Zone'), 'type' => 'select', 'selectarray' => $timezones, 'helptext' => _t('Current Date Time: %s', array(DateTime::create()->format()))), 'dateformat' => array('label' => _t('Date Format'), 'type' => 'text', 'helptext' => _t('Current Date: %s', array(DateTime::create()->date))), 'timeformat' => array('label' => _t('Time Format'), 'type' => 'text', 'helptext' => _t('Current Time: %s', array(DateTime::create()->time))));
$option_items[_t('Language')] = array('locale' => array('label' => _t('Locale'), 'type' => 'select', 'selectarray' => array_merge(array('' => 'default'), array_combine(Locale::list_all(), Locale::list_all())), 'helptext' => Config::exists('locale') ? _t('International language code : This value is set in your config.php file, and cannot be changed here.') : _t('International language code'), 'disabled' => Config::exists('locale'), 'value' => Config::get('locale', Options::get('locale', 'en-us'))), 'system_locale' => array('label' => _t('System Locale'), 'type' => 'text', 'helptext' => _t('The appropriate locale code for your server')));
$option_items[_t('Troubleshooting')] = array('log_min_severity' => array('label' => _t('Minimum Severity'), 'type' => 'select', 'selectarray' => LogEntry::list_severities(), 'helptext' => _t('Only log entries with a this or higher severity.')), 'log_backtraces' => array('label' => _t('Log Backtraces'), 'type' => 'checkbox', 'helptext' => _t('Logs error backtraces to the log table\'s data column. Can drastically increase log size!')));
$option_items = Plugins::filter('admin_option_items', $option_items);
$tab_index = 3;
foreach ($option_items as $name => $option_fields) {
/** @var FormControlFieldset $fieldset */
$fieldset = $form->append(FormControlWrapper::create(Utils::slugify(_u($name)))->set_properties(array('class' => 'container main settings')));
$fieldset->append(FormControlStatic::create($name)->set_static('<h2 class="lead">' . htmlentities($name, ENT_COMPAT, 'UTF-8') . '</h2>'));
$fieldset->set_wrap_each('<div>%s</div>');
foreach ($option_fields as $option_name => $option) {
/** @var FormControlLabel $label */
$label = $fieldset->append(FormControlLabel::create('label_for_' . $option_name, null)->set_label($option['label']));
/** @var FormControl $field */
$field = $label->append($option['type'], $option_name, $option_name);
$label->set_for($field);
if (isset($option['value'])) {
$field->set_value($option['value']);
}
if (isset($option['disabled']) && $option['disabled'] == true) {
$field->set_properties(array('disabled' => 'disabled'));
}
if ($option['type'] == 'select' && isset($option['selectarray'])) {
$field->set_options($option['selectarray']);
}
$field->tabindex = $tab_index;
$tab_index++;
if (isset($option['helptext'])) {
$field->set_helptext($option['helptext']);
}
}
}
$buttons = $form->append(new FormControlWrapper('buttons', null, array('class' => 'container')));
$buttons->append(FormControlSubmit::create('apply', null, array('tabindex' => $tab_index))->set_caption(_t('Apply')));
$form->on_success(array($self, 'form_options_success'));
$form = Plugins::filter('admin_options_form', $form);
});
}