当前位置: 首页>>代码示例>>PHP>>正文


PHP Access类代码示例

本文整理汇总了PHP中Access的典型用法代码示例。如果您正苦于以下问题:PHP Access类的具体用法?PHP Access怎么用?PHP Access使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Access类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Access类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。