本文整理汇总了PHP中Access类的典型用法代码示例。如果您正苦于以下问题:PHP Access类的具体用法?PHP Access怎么用?PHP Access使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Access类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
private function __construct()
{
$mode = isset($_GET['mode']) ? $_GET['mode'] : false;
require 'core/models/class.Access.php';
switch ($mode) {
case 'login':
$login = new Access();
$login->Login();
break;
case 'reg':
if (isset($_POST['faccion'])) {
$reg = new Access();
$reg->Register();
} else {
$lng = new Lang();
$template = new Smarty();
$template->assign(array('x_user' => $lng->x_user, 'x_pass' => $lng->x_pass, 'x_email' => $lng->x_email, 'x_registrarme' => $lng->x_registrarme));
$template->display('public/registro.xnv');
}
break;
default:
$lng = new Lang();
$template = new Smarty();
$template->assign(array('x_user' => $lng->x_user, 'x_pass' => $lng->x_pass, 'x_recordar' => $lng->x_recordar, 'x_submit' => $lng->x_submit));
$template->display('public/index.xnv');
break;
}
unset($lng, $template);
}
开发者ID:Nykus,项目名称:xnova,代码行数:29,代码来源:indexController.php
示例2: delete
public function delete()
{
$Access = new Access($this->data->id);
$Access->delete();
$go = '>auth/Access/formFind';
$this->renderPrompt('information', "Access [{$this->data->idAccess}] removido.", $go);
}
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:7,代码来源:AccessController.php
示例3: getNoParentRootTeam
public function getNoParentRootTeam()
{
$query = " SELECT * ";
$query .= " FROM utenti ";
$query .= " WHERE parent > " . BASE_PARENT_ROOT;
$query .= " AND active = '" . VALUE_YES . "'";
$query .= " ORDER BY parent,cognome ASC ";
$acc = new Access();
$res = $acc->select($query);
return $res;
}
开发者ID:raffaelemorgese,项目名称:levasoo,代码行数:11,代码来源:Team.php
示例4: init
public static function init()
{
$config = Config::load('modules');
self::$default_modules = $config['default'];
$db = DB::get();
$modules = array();
$enabled_modules = array();
if (!empty($config['table'])) {
$table = new $config['table']();
$modules = $table->whereBy('module_enabled', 'Y')->column('module_key');
$enabled_modules = array_merge($enabled_modules, $modules);
}
self::$enabled_modules = array_merge(self::$default_modules, $enabled_modules);
$app = App::get();
Access::reset();
self::$paths = array();
foreach (self::$enabled_modules as $v) {
$cl = 'Pina\\Modules\\' . $v . '\\' . $v . 'Module';
$path = '';
if (class_exists($cl)) {
$c = new $cl();
$path = $c->path();
} else {
$path = App::path() . '/default/Modules/' . $v;
}
self::$paths[$v] = $path;
}
foreach (self::$paths as $base) {
$path = $base . '/' . $app . '/init.php';
if (is_file($path)) {
include_once $path;
}
}
}
开发者ID:pinahq,项目名称:framework,代码行数:34,代码来源:Module.php
示例5: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($idTree)
{
$modelTree = Tree::model()->find('id=:id AND module=:module AND organization=:organization', array(':id' => $idTree, ':module' => 'news', ':organization' => Yii::app()->session['code_no']));
if ($modelTree === null) {
throw new CHttpException(404, 'Страница не найдена.');
}
if (!(Yii::app()->user->admin || Access::model()->checkAccessUserForTree($idTree))) {
throw new CHttpException(403, 'Доступ запрещен.');
}
$model = new News();
$model->id_tree = $idTree;
$model->flag_enable = true;
$model->date_start_pub = date('d.m.Y');
$model->date_end_pub = date('01.m.Y', PHP_INT_MAX);
$model->author = Yii::app()->user->name;
$model->general_page = 0;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['News'])) {
$model->attributes = $_POST['News'];
$model->log_change = LogChange::setLog($model->log_change, 'создание');
if ($model->save()) {
// сохраняем файлы
$model->saveFiles($model->id, $idTree);
// сохраняем изображения
$model->saveImages($model->id, $idTree);
// сохраняем миниатюра изображения
$model->saveThumbailForNews($model);
$this->redirect(array('view', 'id' => $model->id, 'idTree' => $idTree));
}
}
$this->render('create', array('model' => $model, 'idTree' => $idTree));
}
开发者ID:alexeevich,项目名称:portal,代码行数:37,代码来源:NewsController.php
示例6: actionIndex
/**
* 用户组绑定权限
*/
public function actionIndex($id)
{
$id = (int) $id;
$model = Group::model()->findByPk($id);
if ($model->access) {
foreach ($model->access as $g) {
$access[] = $g->access_id;
}
}
$cache = cache('auth_controller_file');
if (!$cache) {
$d = $this->_get_modules(\Yii::getPathOfAlias('application.modules'));
if ($d) {
Access::generate($d);
}
DirHelper::$kep_list_file = false;
cache('auth_controller_file', true);
}
$rows = DB::all('access', array('select' => "id,name,pid"));
foreach ($rows as $v) {
$out[$v['id']] = $v;
}
$rows = ArrHelper::_tree_id($rows);
if ($_POST) {
$auth = $_POST['auth'];
GroupAccess::saveAccess($id, $auth);
cache('acl', false);
flash('success', __('set access success'));
$this->redirect(url('admin/auth/index', array('id' => $id)));
}
return $this->render('index', array('rows' => $rows, 'out' => $out, 'model' => $model, 'id' => $id, 'access' => $access));
}
开发者ID:hiproz,项目名称:mincms,代码行数:35,代码来源:AuthController.php
示例7: studentController
function studentController()
{
if (!Access::check('student')) {
abort404();
}
view('students');
}
开发者ID:Reta110,项目名称:unit-tests,代码行数:7,代码来源:students.php
示例8: load
public static function load($blog_id = null, $user_id = null, $include_count = true, $offset = 0, $limit = BLOG_DISPLAY_LIMIT)
{
$filters = array();
$current_user = \Warden::current_user();
$result = array('data' => array(), 'count' => 0);
if (empty($blog_id)) {
if (empty($user_id)) {
$filters['public_flag'] = true;
//only load public blogs if not loading a specific user's blog
if (!$current_user || !\Access::can('publicize_any_blog', $current_user)) {
$filters['publish_flag'] = true;
//only load published blogs if the user is not privileged to publicize any blog
}
} else {
if (!$current_user || $user_id != $current_user->id) {
$filters['publish_flag'] = true;
//only load published blogs if the user is loading a blog that's not their own
}
$filters['user_id'] = $user_id;
//load blogs for the specified user only
}
$result['data'] = static::get_where($filters, $offset, $limit);
} else {
$result['data'] = static::get_where(array('id' => $blog_id, 0, 1));
}
if (!empty($result['data'])) {
$result['count'] = $include_count ? static::get_count($filters) : count($result['data']);
}
return $result;
}
开发者ID:jkapelner,项目名称:chatroom-web-server,代码行数:30,代码来源:blog.php
示例9: getAdminEntitiesIDs
public function getAdminEntitiesIDs($entity_name)
{
if (\Auth::check()) {
return array_flatten(\Access::where('user_id', \Auth::user()->id)->where('entity_name', $entity_name)->get(['entity_id'])->toArray());
}
return [];
}
开发者ID:CalinB,项目名称:web-directory,代码行数:7,代码来源:Acl.php
示例10: teacherController
function teacherController()
{
if (!Access::check('teacher')) {
abort404();
}
view('teachers');
}
开发者ID:Reta110,项目名称:unit-tests,代码行数:7,代码来源:teachers.php
示例11: action_delete
public function action_delete()
{
$result = array('status' => false, 'error' => array());
try {
$input = Input::post();
if (empty($input) || empty($input['id'])) {
throw new Exception('You must specify a blog to delete.');
}
$blog = Model_Blog::find($input['id']);
if (!$blog) {
throw new Exception('Blog not found.');
}
if (!\Access::can('delete_any_blog', $this->user) && (!\Access::can('delete_own_blog', $this->user) || !Model_Agency_Contact::is_confirmed($blog->user_id, $this->user))) {
throw new Exception('You are not authorized to delete this blog');
}
try {
$blog->delete();
$result['status'] = true;
} catch (\Orm\ValidationFailed $ex) {
$result['error'] = $ex->getMessage();
} catch (Exception $ex) {
$msg = $ex->getMessage();
$result['error'] = $msg ? $msg : 'Oops, something went wrong.';
}
} catch (Exception $ex) {
$result['error'] = $ex->getMessage();
}
return $this->response($result);
}
开发者ID:jkapelner,项目名称:chatroom-web-server,代码行数:29,代码来源:blog.php
示例12: access
/**
* 返回access 里面name
*/
function access()
{
$model = Access::find()->all();
$t = \app\core\Arr::parentTree($model, $this->access_id);
unset($s);
foreach ($t as $v) {
$s .= $v . ".";
}
return substr($s, 0, -1);
}
开发者ID:rocketyang,项目名称:mincms,代码行数:13,代码来源:GroupAccess.php
示例13: has_access
/**
* has_access
* This function returns true or false if the current user
* has access to this playlist
*/
public function has_access()
{
if (!Access::check('interface', '25')) {
return false;
}
if ($this->user == $GLOBALS['user']->id) {
return true;
} else {
return Access::check('interface', '100');
}
}
开发者ID:axelsimon,项目名称:ampache,代码行数:16,代码来源:playlist_object.abstract.php
示例14: checkPass
function checkPass($chave)
{
session::delete('id_user');
if (!Access::where('accesskey', $chave)->exists()) {
return true;
} else {
$a = Access::where('accesskey', $chave)->get();
session::set('id_user', $a[0]->id_user);
return false;
}
}
开发者ID:avneto,项目名称:painelAdministrativo,代码行数:11,代码来源:UserController.php
示例15: update_preferences
function update_preferences($pref_id = 0)
{
/* Get current keys */
$sql = "SELECT `id`,`name`,`type` FROM `preference`";
/* If it isn't the System Account's preferences */
if ($pref_id != '-1') {
$sql .= " WHERE `catagory` != 'system'";
}
$db_results = Dba::read($sql);
$results = array();
// Collect the current possible keys
while ($r = Dba::fetch_assoc($db_results)) {
$results[] = array('id' => $r['id'], 'name' => $r['name'], 'type' => $r['type']);
}
// end collecting keys
/* Foreach through possible keys and assign them */
foreach ($results as $data) {
/* Get the Value from POST/GET var called $data */
$name = $data['name'];
$apply_to_all = 'check_' . $data['name'];
$new_level = 'level_' . $data['name'];
$id = $data['id'];
$value = scrub_in($_REQUEST[$name]);
/* Some preferences require some extra checks to be performed */
switch ($name) {
case 'transcode_bitrate':
$value = Stream::validate_bitrate($value);
break;
default:
break;
}
if (preg_match('/_pass$/', $name)) {
if ($value == '******') {
unset($_REQUEST[$name]);
} else {
if (preg_match('/md5_pass$/', $name)) {
$value = md5($value);
}
}
}
/* Run the update for this preference only if it's set */
if (isset($_REQUEST[$name])) {
Preference::update($id, $pref_id, $value, $_REQUEST[$apply_to_all]);
}
if (Access::check('interface', '100') && $_REQUEST[$new_level]) {
Preference::update_level($id, $_REQUEST[$new_level]);
}
}
// end foreach preferences
// Now that we've done that we need to invalidate the cached preverences
Preference::clear_from_session();
}
开发者ID:cheese1,项目名称:ampache,代码行数:52,代码来源:preferences.php
示例16: action_client
/**
* страница работы с клиентом
*/
public function action_client()
{
$clientId = $this->request->param('id');
Access::check('client', $clientId);
$client = Model_Client::getClient($clientId);
$contracts = Model_Contract::getContracts($clientId);
if (empty($client)) {
throw new HTTP_Exception_404();
}
$popupContractAdd = Common::popupForm('Добавление нового договора', 'contract/add');
$popupCabinetCreate = Common::popupForm('Создание личного кабинета', 'client/cabinet_create');
$this->tpl->bind('client', $client)->bind('contracts', $contracts)->bind('popupContractAdd', $popupContractAdd)->bind('popupCabinetCreate', $popupCabinetCreate);
}
开发者ID:paShaman,项目名称:Scala,代码行数:16,代码来源:Clients.php
示例17: testClear
/**
* @covers Xoops\Core\Cache\Access::clear
* @covers Xoops\Core\Cache\Access::write
* @covers Xoops\Core\Cache\Access::read
*/
public function testClear()
{
$key = 'offhand/name';
$value = 'Fred';
$ret = $this->object->write($key, $value);
$this->assertTrue($ret);
$ret = $this->object->read($key);
$this->assertSame($ret, $value);
$ret = $this->object->clear();
$this->assertTrue($ret);
$ret = $this->object->read($key);
$this->assertFalse($ret);
}
开发者ID:RanLee,项目名称:XoopsCore,代码行数:18,代码来源:AccessTest.php
示例18: access
/**
* 返回access 里面name
*/
function access($access_id = null)
{
$model = Access::model()->findAll();
if (!$access_id) {
$access_id = $this->access_id;
}
$t = \ArrHelper::parentTree($model, $access_id);
unset($s);
foreach ($t as $v) {
$s .= $v . ".";
}
return substr($s, 0, -1);
}
开发者ID:hiproz,项目名称:mincms,代码行数:16,代码来源:GroupAccess.php
示例19: ps_1702_right_management
/**
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <[email protected]>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
function ps_1702_right_management()
{
$actions = array('CREATE', 'READ', 'UPDATE', 'DELETE');
/**
* Add roles
*/
foreach (array('TAB', 'MODULE') as $element) {
foreach ($actions as $action) {
Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'authorization_role`
(`slug`)
SELECT CONCAT("ROLE_MOD_' . $element . '_", UCASE(`class_name`), "_' . $action . '")
FROM `' . _DB_PREFIX_ . strtolower($element) . '`
');
}
}
/**
* Add access
*/
$accessObject = new Access();
// Tabs
$oldAccess = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'access_old`');
foreach ($oldAccess as $currOldAccess) {
foreach (array('view', 'add', 'edit', 'delete') as $action) {
if (array_key_exists($action, $currOldAccess) && $currOldAccess[$action] == '1') {
$accessObject->updateLgcAccess($currOldAccess['id_profile'], $currOldAccess['id_tab'], $action, true);
}
}
}
// Modules
$oldAccess = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'module_access_old`');
foreach ($oldAccess as $currOldAccess) {
foreach (array('configure', 'view', 'uninstall') as $action) {
if (array_key_exists($action, $currOldAccess) && $currOldAccess[$action] == '1') {
$accessObject->updateLgcAccess($currOldAccess['id_profile'], $currOldAccess['id_tab'], $action, true);
}
}
}
}
开发者ID:M03G,项目名称:PrestaShop,代码行数:63,代码来源:ps_1702_right_management.php
示例20: configuration
private function configuration()
{
Assets::$test = TRUE;
// Delete in real
$this->fc = FrontController::getInstance();
$this->controller = strtolower(str_replace('Controller', '', $this->fc->getController()));
$this->action = strtolower(str_replace('Action', '', $this->fc->getAction()));
$this->view = new View();
$this->params = $this->fc->getParams();
if ($this->controller == 'error') {
return;
}
// Users and Access
$this->mu = M_Users::Instance();
$this->user = $this->mu->GetUser();
$accessByIp = IpAccess::isAccess($_SERVER['REMOTE_ADDR']);
if ((!$accessByIp || $this->user->locked) && $this->controller != 'authorization') {
$expire = time() + 3600 * 24 * 100;
setcookie('rUrl', $_SERVER['REQUEST_URI'], $expire, "/");
$this->redirect(array('authorization', 'login'));
exit;
}
$access = new Access();
$access->fillFromUser($this->user);
$access->setAccessParams($this->controller, $this->action);
$sectionAccess = $access->sectionAccess();
$actionAccess = $access->actionAccess();
if (!$sectionAccess || !$actionAccess) {
if ($this->user->isGuest) {
$expire = time() + 3600 * 24 * 100;
setcookie('rUrl', $_SERVER['REQUEST_URI'], $expire, "/");
$this->redirect(array('authorization', 'login'));
}
$pageArr = $access->UserAccessPage;
$redirectArray = $pageArr ? $pageArr : array('error', '');
$this->redirect($redirectArray);
}
$this->access = $access;
$sInfo = $access->actionAccess(array('service', 'info')) ? true : false;
$this->fc->setSInfo($sInfo);
unset($access);
$this->pageTitle = __('pageTitle');
$array = array('access' => $this->access, 'controller' => $this->controller, 'action' => $this->action, 'user' => $this->user);
$this->setMainVars($array);
if (!empty($_POST)) {
$_POST = AF::clearDataArray($_POST);
}
// Set user
AF::setUser($this->user);
AF::setUserAccess($this->access);
//$sectionID = ( isset($this->params['id']) && is_numeric($this->params['id']) ) ? $this->params['id'] : '';
//Log::createLog($this->user->user_id, $this->action."Action", $this->controller, $sectionID);
}
开发者ID:,项目名称:,代码行数:53,代码来源:
注:本文中的Access类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论