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'); }
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'); }
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>'; } } }
<?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) {
<?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'];
<?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) {
<?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);
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; }
<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 {
<?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"; //}
$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;
<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
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'); }
<?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;
<?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);
<?php require_once "inc/config.php"; check_role($ROLE_USER); $tem = template_open("help.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]; $sql = 'SELECT `applic`.`name` aname,`work`.`name` wname,`work`.`opis` wopis FROM work,applic where `work`.`applic_id`=`applic`.`applic_id` and `work`.`group`<=86 order by `applic`.`name` '; $result = $db->fetchAll($sql); //log_id timestamp person_id jobtype_id start end note job_id name description foreach ($result as $res) { $table .= $row; $table = str_replace("##APP_NAME##", $res["aname"], $table); $table = str_replace("##NAME_WORK##", $res["wname"], $table); $table = str_replace("##DESC_WORK##", $res["wopis"], $table); //echo "<br>".$res['timestamp']." - ".date("H:i",$res['start'])." - ".date("H:i",$res['stop'])." - ".$res['name']." - ".$res['description']; } $tem = str_replace("##MONTH##", " " . $mon . "/" . $year, $tem); //v header sem dal zraven naslova izpis meseca za katerega je izpis $tem = str_replace('##TITLE##', $TITLE, $tem); $tem = str_replace('##USER##', $identity, $tem); $tem = str_replace("##LOGS##", $table, $tem); $tem = str_replace("##MESSAGE##", $message, $tem); $tem = template_clean_up_tags($tem, "##"); echo $tem;
<?php session_start(); /// initialize session include "../../code/php/AC.php"; $user_name = check_logged(); /// function checks if visitor is logged. echo '<script type="text/javascript"> user_name = "' . $user_name . '"; </script>' . "\n"; $allowed = false; if (check_role("admin")) { echo '<script type="text/javascript"> role = "admin"; </script>' . "\n"; $allowed = true; } $r = 'requests'; // collect .json files from the request directory to construct a table of current requests $req = array(); if (is_dir($r) && is_readable($r)) { if ($handle = opendir($r)) { while (false !== ($entry = readdir($handle))) { $file_parts = pathinfo($entry); if ($entry != "." && $entry != ".." && $file_parts['extension'] == 'json') { $req[] = json_decode(file_get_contents($r . "/" . $entry), true); } } closedir($handle); } } ?> <!DOCTYPE html> <html lang="en">
<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['master'], $item['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