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


PHP check_role函数代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->library('session');
     $this->load->helper(array("url", "y4a", "form"));
     $this->load->model("Musergroup");
     $this->canView = check_role('usergroup', 'view');
     $this->canEdit = check_role('usergroup', 'edit');
 }
开发者ID:anhnt0212,项目名称:admin-codeigniter-fw,代码行数:9,代码来源:usergroup.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->library('session');
     $this->load->helper(array("url", "y4a"));
     $this->load->model("Mmenucategory");
     $this->canView = check_role('menucategory', 'view');
     $this->canEdit = check_role('menucategory', 'edit');
 }
开发者ID:anhnt0212,项目名称:admin-codeigniter-fw,代码行数:9,代码来源:menucategory.php

示例3: in_menu

function in_menu($ds_lbv, $ma)
{
    foreach ($ds_lbv as $lbv) {
        if ($lbv['parent_id'] == $ma) {
            if (kiem_tra_co_con($ds_lbv, $lbv['id'])) {
                if (check_role($lbv['link'], 'view') || 0) {
                    echo '<li><a href="javascript:;"><i class="' . $lbv['icon'] . '"></i><span>' . $lbv['title'] . '</span></a>';
                }
                echo '<ul class="acc-menu">';
                in_menu($ds_lbv, $lbv['id']);
                echo '</ul>';
            } else {
                if (check_role($lbv['link'], 'view') || 0) {
                    $links = '<a href="' . site_url($lbv['link']) . '">';
                    echo '<li>' . $links . '<i class="' . $lbv['icon'] . '"></i><span>' . $lbv['title'] . '</span></a>';
                }
            }
            echo '</li>';
        }
    }
}
开发者ID:anhnt0212,项目名称:admin-codeigniter-fw,代码行数:21,代码来源:left.php

示例4: check_role

<?php

//*$DO_NOT_REDIRECT="true";*/
require_once "inc/config.php";
check_role($ROLE_EMPLOYED, "login.php");
$TITLE = "Evidenca zaposlenih";
$tem = template_open("NEWaktivnosti_employe.tpl");
$tem = template_add_head_foot($tem, head, foot);
$sql = "SELECT `work_id`,`work`.`applic_id`,`subcat_id`, `applic`.`name` Program, `work`.`name` name, `opis` FROM `work`,`applic` WHERE '{$role_id}'>=`group` and `group`>'{$ROLE_USER}' and `work`.`applic_id`=`applic`.`applic_id` ORDER BY `work`.`applic_id`,`subcat_id`";
$qhour_start_time = range(0, 23);
//$qhour_start_time_dropdown = html_drop_down_arrays("hour_start_time_drop",$qhour_start_time,$qhour_start_time,"8");//date("H",time()));
$qhour_start_time_dropdown = html_drop_down_arrays("hour_start_time_drop", $qhour_start_time, $qhour_start_time, $hour_start_time_drop);
//date("H",time()));
$qmin_start_time = range(0, 59);
$qmin_start_time_dropdown = html_drop_down_arrays("min_start_time_drop", $qmin_start_time, $qmin_start_time, $min_start_time_drop);
//date("H",time()));
$qhour_stop_time = range(0, 23);
$qhour_stop_time_dropdown = html_drop_down_arrays("hour_stop_time_drop", $qhour_stop_time, $qhour_stop_time, $hour_stop_time_drop);
//date("H",time()));
$qmin_stop_time = range(0, 59);
$qmin_stop_time_dropdown = html_drop_down_arrays("min_stop_time_drop", $qmin_stop_time, $qmin_stop_time, $min_stop_time_drop);
//date("H",time()));
$qday = range(1, 31);
$day_dropdown = html_drop_down_arrays("day_drop", $qday, $qday, date("j", time()));
$qmonth = range(1, 12);
$month_dropdown = html_drop_down_arrays("month_drop", $qmonth, $qmonth, date("n", time()));
$qyear = range(2009, date("Y", time()) + 1);
$year_dropdown = html_drop_down_arrays("year_drop", $qyear, $qyear, date("Y", time()));
//$sql = 'SELECT * FROM `work` WHERE $role_id>=`group` and `group`>$ROLE_USER ORDER BY `work`.`applic_id`,`subcat_id`";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
开发者ID:urki,项目名称:urki-test-project,代码行数:31,代码来源:add_work_emplo.php

示例5: set_time_limit

<?php

/**
 * Created by PhpStorm.
 * User: admin64
 * Date: 02.04.2016
 * Time: 10:48
 */
// Подключение к базе данных;
require_once $_SERVER['DOCUMENT_ROOT'] . '/systems/connect.php';
set_time_limit(0);
// Проверяем роли;
$parent = 'reklama_report';
check_role($parent);
$html = $elements->small_title('Сводная - офисы' . ($_SESSION['reklama_report_view_type'] == 'date1' ? ' сформирован по дате приема' : ' сформирован по дате выдачи'));
/*
 *
 * Подготавливаем массивы и переменные
 *
 * */
// Зададим массив куда мы запихнем обработанные данные;
$table_array = array();
if ($_SESSION['reklama_report_date_from'] != '' && $_SESSION['reklama_report_date_to'] != '') {
    $date_from = strtotime($_SESSION['reklama_report_date_from']);
    $date_to = strtotime($_SESSION['reklama_report_date_to']);
} else {
    $date_from = strtotime(date('Y-m-d'));
    $date_to = strtotime(date('Y-m-d'));
}
if (isset($_SESSION['reklama_report_view_type'])) {
    $view_date = $_SESSION['reklama_report_view_type'];
开发者ID:uvaron,项目名称:BDparser,代码行数:31,代码来源:summary_offices.php

示例6: header

<?php

require_once "inc/config.php";
header("refresh:120;url=view_notice.php");
check_role($ROLE_EMPLOYED);
$TITLE = "Glavna stran";
$tem = template_open("view_notice.tpl");
$tem = template_add_head_foot($tem, head, foot);
$tmp = template_get_repeat_text("##START_LOG##", "##STOP_LOG##", "##LOGS##", $tem);
$row = $tmp[1];
$tem = $tmp[0];
/**
 * Obdelava feedback 
 */
$sql = "SELECT * FROM `feedback` WHERE `modified_by`={$person_id} and `status` in (0, 1) order by id desc";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
    $table .= $row;
    $table = str_replace("##FEEDBTIME##", $res[timestamp], $table);
    $table = str_replace("##FEEDBNOTE##", substr($res["note"], 0, 120) . '...', $table);
}
/**
 *Izpis končanih v feedback 
 */
$tmp = template_get_repeat_text("##START END##", "##STOP_END##", "##LOGS2##", $tem);
$row = $tmp[1];
$tem = $tmp[0];
unset($result);
$sql = "SELECT * FROM `feedback` WHERE `modified_by`={$person_id} and `status` =2 order by id desc LIMIT 0 , 4";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
开发者ID:urki,项目名称:urki-test-project,代码行数:31,代码来源:view_notice.php

示例7: check_role

<?php

/**
 * Created by PhpStorm.
 * User: admin64
 * Date: 28.01.2016
 * Time: 18:19
 */
// Подключение к базе данных;
require_once $_SERVER['DOCUMENT_ROOT'] . '/systems/connect.php';
// Проверяем роли;
check_role(basename($_SERVER['SCRIPT_NAME'], ".php"));
if (count($_POST) == 0 && count($_GET) == 0) {
    $html = '';
    $html .= '';
    // Заголовок страницы;
    $html .= $elements->title(basename($_SERVER['SCRIPT_NAME'], ".php"));
    // Кнопка на странице перемещений;
    $html .= $elements->button('Загрузить фотографии', 'upload_new_photos', '', '', '');
    //$html .= '<div class="menu_button" onclick="show_upload_form()">Загрузить фотографии</div>';
    $html .= $elements->button('Просмотр архива', 'view_photo_archive', '', '', '');
    //$html .= '<div class="menu_button" onclick="show_photo_archive()">Просмотр архива</div>';
    $html .= '<div class="photo_archive_page" style="margin-top: 10px;"></div>';
    $html .= '';
    echo $html;
} else {
    // Отображение фотоархива;
    if (isset($_POST['show_photo_archive']) && $_POST['show_photo_archive'] != '') {
        // Получаем список фото архивов;
        $sql = "select `numm`, `users_apps`.`user_name`, `photo_numm_archive`.`date` from `photo_numm_archive`\n            left join `users_apps` on `users_apps`.`id` = `photo_numm_archive`.`author_user_id`\n             where `status` = 1 group by `numm` order by `photo_numm_archive`.`date` desc";
        $archive_array = $db_rs->all($sql);
开发者ID:uvaron,项目名称:BDparser,代码行数:31,代码来源:photo_archive.php

示例8: list_permissions

function list_permissions($role_in)
{
    global $_SESSION;
    if (!isset($_SESSION)) {
        session_start();
    }
    $user_name = check_logged();
    /// function checks if visitor is logged in.
    if (!$user_name) {
        return;
    }
    $allowed = false;
    if (!check_role("admin")) {
        return false;
    }
    // read the permissions database
    $d = loadDB();
    if ($role_in !== null) {
        // return role names of the current user
        foreach ($d["roles"] as $key => $value) {
            if ($value["name"] == $role_in) {
                $permissions_names = array();
                foreach ($value["permissions"] as $perm) {
                    foreach ($d["permissions"] as $r) {
                        if ($perm == $r["id"]) {
                            $permissions_names[] = $r["name"];
                        }
                    }
                }
                return $permissions_names;
            }
        }
    } else {
        // return all role names
        $permissions_names = array();
        foreach ($d["permissions"] as $r) {
            $permissions_names[] = $r['name'];
        }
        return $permissions_names;
    }
    return;
}
开发者ID:ABCD-STUDY,项目名称:FIONASITE,代码行数:42,代码来源:AC.php

示例9: sample

  <div>

    <h2>Auth sample (status)</h2>


<?php 
if (is_logged()) {
    ?>

  you are logged as: <?php 
    echo get_user_data("user_name");
    ?>
 
  
  <?php 
    if (check_role(3)) {
        ?>
 
    (administrator) 
  <?php 
    }
    ?>
 | 
  
  <?php 
    echo anchor_lang("rapyd/auth/logout", "Log Out");
    ?>
 
  
<?php 
} else {
开发者ID:codethics,项目名称:proteoerp,代码行数:31,代码来源:auth.php

示例10: check_role

<?php

//*$DO_NOT_REDIRECT="true";*/
require_once "inc/config.php";
check_role($ROLE_LEADER);
$tem = template_open("add_log_admin.tpl");
$tem = template_add_head_foot($tem, head, foot);
$TITLE = "Evidenca OE";
//pogoj, da lahko vsi ki imajo nad 80 role_id vidijo vse in dopisujejo vse
if ($role_id < 80) {
    $sql = "SELECT * FROM persons where unit={$role_id} and id_role>30 order by last ASC";
} else {
    $sql = "SELECT * FROM persons where id_role>30 order by first ASC";
}
$result = $db->fetchAll($sql);
foreach ($result as $res) {
    if (!is_array($names)) {
        $names[] = "ime in priimek zaposlenega...";
        $values[] = "";
    }
    $names[] .= $res["first"] . " " . $res["last"];
    $values[] .= $res["id_person"];
}
$name_dropdown = html_drop_down_arrays("name_drop", $names, $values, $name_drop);
//pogoj, da lahko vsi ki imajo nad 80 role_id vpisujejo vse JOBTYPE, ostali pa ne
//if ($role_id<80){
//  $sql = "SELECT * FROM jobtype where role between 30 and 79 order by name ASC";
//	}
//else {
//    $sql = "SELECT * FROM jobtype where role > 79 order by name ASC";
//}
开发者ID:urki,项目名称:urki-test-project,代码行数:31,代码来源:add_log_leader.php

示例11: tname

     $query = $_SGLOBAL['db']->query('select * from ' . tname('open_member_weixin') . ' where op_uid=' . $_SGLOBAL['uid'] . ' and id=' . $id . ' and state>-1');
     if ($account = $_SGLOBAL['db']->fetch_array($query)) {
         $account['headimg'] = $_SC['img_url'] . '/weixin_headimg/' . $account['fakeid'] . '.png';
         $smarty->assign('account', $account);
     }
     //获取所有模块
     $modules = $_SGLOBAL['db']->getall('select * from ' . tname('open_module') . ' where ispublic=1');
     foreach ($modules as $k => $v) {
         $modules[$k]['enabled'] = getcount(tname('weixin_module'), array('op_uid' => $op_uid, 'op_wxid' => $id, 'mid' => $v['mid'], 'enabled' => 1));
     }
     $smarty->assign('modules', $modules);
     $smarty->display('wx_account_manage.dwt');
     break;
 case "del":
     $id = intval($_GET['id']) ? intval($_GET['id']) : 0;
     check_role($id);
     updatetable(tname('open_member_weixin'), array('password' => '', 'state' => -1), array('id' => $id));
     updatetable(tname('weixin_member'), array('state' => -1), array('op_wxid' => $id));
     gourl('wx_account.php');
     break;
 default:
     $total = getcount(tname('open_member_weixin'), array('op_uid' => $_SGLOBAL['uid']));
     $smarty->assign('total', $total);
     $account = $_SGLOBAL['db']->getall('select * from ' . tname('open_member_weixin') . ' where op_uid=' . $_SGLOBAL['uid'] . ' and state>-1');
     foreach ($account as $k => $v) {
         $account[$k]['weidian_state'] = $_SGLOBAL['db']->getone('select value from ' . tname('wz_weixin_setting') . ' where op_wxid=' . $v['id'] . ' and mid=1 and var="state"');
         $account[$k]['headimg'] = $_SC['img_url'] . '/weixin_headimg/' . $v['fakeid'] . '.png';
     }
     $smarty->assign('account', $account);
     $smarty->display('wx_account.dwt');
     break;
开发者ID:hugolong,项目名称:weixiao,代码行数:31,代码来源:wx_account.php

示例12: foreach

		<th>位置</th>
	</tr>
	
 <?php 
if (!empty($datalist)) {
    ?>
 <?php 
    foreach ($datalist as $item) {
        ?>
    <tr style="font-size: 12px;">
        <td><?php 
        echo $item['host'] . ':' . $item['port'];
        ?>
</td>
        <td><?php 
        echo check_role($item['is_master'], $item['is_slave']);
        ?>
</td>
        <td><?php 
        echo $item['read_only'];
        ?>
</td>
        <td><?php 
        echo $item['application'];
        ?>
</td>
        <td><?php 
        echo check_value($item['slave_io_run']);
        ?>
</td>
        <td><?php 
开发者ID:noikiy,项目名称:MySQL-monitor,代码行数:31,代码来源:replication.php

示例13: autoreply_list

function autoreply_list()
{
    global $_SGLOBAL, $smarty, $_SC;
    $op_wxid = intval($_GET['id']) ? intval($_GET['id']) : 0;
    $op_uid = $_SGLOBAL['uid'];
    check_role($op_wxid);
    $query = $_SGLOBAL['db']->query('select * from ' . tname('open_member_weixin') . ' where op_uid="' . $op_uid . '" and id="' . $op_wxid . '"');
    if ($account = $_SGLOBAL['db']->fetch_array($query)) {
        if ($account['headimg'] == '') {
            $account['headimg'] = $_SC['img_url'] . '/weixin_headimg/' . $account['fakeid'] . '.png';
        }
        $page = empty($_REQUEST["page"]) ? 1 : intval($_REQUEST["page"]);
        $pagesize = empty($_REQUEST["pagesize"]) ? 10 : intval($_REQUEST["pagesize"]);
        $type = getstr($_GET['type']);
        $querystr = "";
        $queryarray = array();
        $queryarray[] = 'op_wxid="' . $op_wxid . '"';
        $queryarray[] = 'state>-1';
        if ($type) {
            $queryarray[] = 'type="' . $type . '"';
        }
        $querystr = "where 1=1";
        foreach ($queryarray as $k => $v) {
            $querystr = $querystr . " and " . $v;
        }
        $query = $_SGLOBAL['db']->query('select * from ' . tname('open_member_weixin_autoreply') . ' ' . $querystr);
        $total = $_SGLOBAL['db']->num_rows($query);
        $pagenum = intval($total / $pagesize);
        if ($total % $pagesize) {
            $pagenum++;
        }
        if ($page > $pagenum) {
            $page = $pagenum;
        }
        $offset = $pagesize * ($page - 1);
        if ($offset < 0) {
            $offset = 0;
        }
        $sql = 'select * from ' . tname('open_member_weixin_autoreply') . ' ' . $querystr . ' order by priority desc limit ' . $offset . ',' . $pagesize;
        $list = $_SGLOBAL['db']->getall($sql);
        $type_name = array('focus' => '关注后回复', 'aftermsg' => '默认回复', 'keyword' => '关键词回复');
        $reply_type_name = array('text' => '文本回复', 'single_news' => '单图文回复', 'multi_news' => '多图文回复');
        foreach ($list as $k => $v) {
            $list[$k]['type_name'] = $type_name[$v['type']];
            $list[$k]['reply_type_name'] = $reply_type_name[$v['reply_type']];
        }
        $arr = array("pagesize" => $pagesize, "page" => $page, "nextpage" => $page + 1, "prepage" => $page - 1, "next_page_url" => 'wx_account_autoreply.php?type=' . $type . '&id=' . $op_wxid . '&page=' . ($page + 1), "pre_page_url" => 'wx_account_autoreply.php?type=' . $type . '&id=' . $op_wxid . '&page=' . ($page - 1), "op_wxid" => $op_wxid, "type" => $type, "pagenum" => $pagenum, "total" => $total, "offset" => $offset, "err" => 0);
        if ($total > 0) {
            $count = 1;
            foreach ($list as $k => $v) {
                $list[$k]['count'] = $count + $offset;
                $arr['list'][] = $list[$k];
                $count++;
            }
        }
        $account = array_merge($arr, $account);
        $smarty->assign('account', $account);
    }
    $smarty->display('wx_account_autoreply.dwt');
}
开发者ID:hugolong,项目名称:weixiao,代码行数:60,代码来源:wx_account_autoreply.php

示例14: check_role

<?php

require_once "inc/config.php";
check_role(78, "index.php");
$tem = template_open("main.tpl");
$tem = template_add_head_foot($tem, head, foot);
$tem = str_replace('##USER##', $identity, $tem);
$tem = template_clean_up_tags($tem, "##");
echo $tem;
开发者ID:urki,项目名称:urki-test-project,代码行数:9,代码来源:main.php

示例15: check_role

<?php

require_once "inc/config.php";
check_role($ROLE_ADMIN);
$tem = template_open("add_address.tpl");
$tem = template_add_head_foot($tem, head, foot);
$username = ereg_replace("[^[A-z]]", "", $_REQUEST['username']);
$password = ereg_replace("[^[A-z]]", "", $_REQUEST['password']);
$first = ereg_replace("[^[:alnum:] ]", "", $_REQUEST['first']);
$last = ereg_replace("[^[:alnum:] ]", "", $_REQUEST['last']);
echo "do sem";
$sql = "SELECT * FROM roles";
//TitleGroup";
$result = $db->fetchAll($sql);
foreach ($result as $res) {
    $names[] .= $res["name"];
    $values[] .= $res["id_role"];
}
$role_dropdown = html_drop_down_arrays("role_drop", $names, $values, "");
if ($_REQUEST['add'] == "Dodaj") {
    //echo $username."-".$password."-".$first."-".$last."-".$role_drop;
    if ($username and $password and $first and $last) {
        //pogledamo kaj imamo in ce je ze tak notr slucajn...
        $sql = "SELECT first FROM persons where first='{$first}' and last='{$last}'";
        $result = $db->fetchOne($sql);
        if ($result) {
            $message .= "Uporabnik ze obstaja";
        } else {
            // dejansko vnesemo
            $data = array('username' => $username, 'passwd' => $password, 'first' => $first, 'last' => $last, 'id_role' => $role_drop);
            $db->insert('persons', $data);
开发者ID:urki,项目名称:urki-test-project,代码行数:31,代码来源:add_address.php


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