本文整理汇总了PHP中checkPerm函数的典型用法代码示例。如果您正苦于以下问题:PHP checkPerm函数的具体用法?PHP checkPerm怎么用?PHP checkPerm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkPerm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
require_once _base_ . '/lib/lib.json.php';
$this->db = DbConn::getInstance();
$this->model = new GroupmanagementAdm();
$this->json = new Services_JSON();
$this->permissions = array('view' => checkPerm('view', true, 'groupmanagement'), 'add' => checkPerm('add', true, 'groupmanagement'), 'mod' => checkPerm('mod', true, 'groupmanagement'), 'del' => checkPerm('del', true, 'groupmanagement'), 'associate_user' => checkPerm('associate_user', true, 'groupmanagement'));
}
示例2: del
/**
* function del
* @param int $id contains the resource id
* @param string $back_url contains the back url (not used yet)
* @return false if fail, else return the id lo
**/
function del($id, $back_url = NULL)
{
checkPerm('view', false, 'storage');
unset($_SESSION['last_error']);
//finding quest
$reQuest = sql_query("\r\n\t\tSELECT q.id_quest, q.type_quest, t.type_file, t.type_class \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type_poll AS t \r\n\t\tWHERE q.id_poll = '" . $id . "' AND q.type_quest = t.type_quest");
if (!mysql_num_rows($reQuest)) {
return true;
}
//deleting answer
while (list($id_quest, $type_quest, $type_file, $type_class) = sql_fetch_row($reQuest)) {
require_once $GLOBALS['where_lms'] . '/modules/question_poll/' . $type_file;
$quest_obj = eval("return new {$type_class}( {$id_quest} );");
if (!$quest_obj->del()) {
$_SESSION['last_error'] = Lang::t('_OPERATION_FAILURE');
return false;
}
}
if (!sql_query("DELETE FROM " . $GLOBALS['prefix_lms'] . "_polltrack WHERE id_poll = '" . $id . "'")) {
$_SESSION['last_error'] = Lang::t('_OPERATION_FAILURE');
return false;
}
if (!sql_query("DELETE FROM " . $GLOBALS['prefix_lms'] . "_pollquest WHERE id_poll = '" . $id . "'")) {
$_SESSION['last_error'] = Lang::t('_OPERATION_FAILURE');
return false;
}
if (!sql_query("DELETE FROM " . $GLOBALS['prefix_lms'] . "_poll WHERE id_poll = '" . $id . "'")) {
$_SESSION['last_error'] = Lang::t('_OPERATION_FAILUREPOLL');
return false;
}
return $id;
}
示例3: switch
function &create_activeTab(&$tv)
{
switch ($tv->getActiveTab()) {
case 'storage_home':
if (checkPerm('home', true, 'storage')) {
$repo = createModule('homerepo');
}
break;
case 'storage_pubrepo':
if (checkPerm('public', true, 'storage')) {
$repo = createModule('pubrepo');
}
break;
case 'storage_course':
default:
if (checkPerm('lesson', true, 'storage')) {
$tv->setActiveTab('storage_course');
$repo = createModule('organization');
} elseif (checkPerm('home', true, 'storage')) {
$tv->setActiveTab('storage_home');
$repo = createModule('homerepo');
} elseif (checkPerm('public', true, 'storage')) {
$tv->setActiveTab('storage_pubrepo');
$repo = createModule('pubrepo');
} else {
$tv->setActiveTab('storage_course');
$repo = createModule('organization');
}
break;
}
return $repo;
}
示例4: select_permission
function select_permission()
{
checkPerm('view');
require_once $GLOBALS['where_lms'] . '/lib/lib.middlearea.php';
require_once _base_ . '/lib/lib.userselector.php';
require_once _base_ . '/lib/lib.form.php';
$lang =& DoceboLanguage::createInstance('middlearea', 'lms');
$obj_index = importVar('obj_index', false, '');
// first step load selector
$man_ma = new Man_MiddleArea();
$acl_manager = new DoceboACLManager();
$user_select = new UserSelector();
$user_select->show_user_selector = TRUE;
$user_select->show_group_selector = TRUE;
$user_select->show_orgchart_selector = TRUE;
$user_select->show_orgchart_simple_selector = false;
//$user_select->multi_choice = TRUE;
// try to load previous saved
if (isset($_GET['load'])) {
$selected = $man_ma->getObjIdstList($obj_index);
if (is_array($selected)) {
$user_select->resetSelection($selected);
}
}
if (isset($_POST['okselector'])) {
$selected = $user_select->getSelection($_POST);
$re = $man_ma->setObjIdstList($obj_index, $selected);
Util::jump_to('index.php?modname=middlearea&op=view_area&result=' . ($re ? 'ok' : 'err'));
}
cout(getTitleArea(array('index.php?modname=middlearea&op=view_area' => $lang->def('_MIDDLE_AREA'), Lang::t('_VIEW_PERMISSION', 'standard')), 'middlearea') . '<div class="std_block">');
$user_select->addFormInfo(Form::getHidden('obj_index', 'obj_index', $obj_index));
$user_select->loadSelector('index.php?modname=middlearea&op=select_permission', false, false, true);
cout('</div>');
}
示例5: init
public function init()
{
parent::init();
$this->json = new Services_JSON();
$this->model = new LocationAlms();
$this->perm = array('view' => checkPerm('view', true, 'location', 'lms'), 'mod' => checkPerm('mod', true, 'location', 'lms'));
}
示例6: getBoxContent
function getBoxContent()
{
$html = array();
if (!checkPerm('view_org_chart', true, 'directory', 'framework')) {
return $html;
}
require_once _base_ . '/lib/lib.userselector.php';
$user_dir = new UserSelector();
$user_stats = $user_dir->getUsersStats();
$lang =& DoceboLanguage::createInstance('dashboard', 'framework');
if (Get::sett('welcome_use_feed') == 'on') {
require_once _base_ . '/lib/lib.fsock_wrapper.php';
$fp = new Fsock();
$released_version = $fp->send_request('http://www.formalms.org/versions/release.txt');
if (!$fp) {
$released_version = '<strong class="old_release">' . $lang->def('_UNKNOWN_RELEASE') . '</strong>';
} else {
if ($released_version == false) {
$released_version = '<strong class="ok_release">' . $lang->def('_UNKNOWN_RELEASE') . '</strong>';
}
if ($released_version == Get::sett('core_version')) {
$released_version = '<strong class="ok_release">' . $released_version . '</strong>';
} else {
$released_version = '<strong class="old_release">' . $released_version . ' (' . $lang->def('_NEW_RELEASE_AVAILABLE') . ')</strong>';
}
}
}
$html[] = '<h2 class="inline">' . $lang->def('_USERS_PANEL') . '</h2>' . '<p>' . $lang->def('_TOTAL_USER') . ': <b>' . ($user_stats['all'] - 1) . '</b>;<br />' . $lang->def('_SUSPENDED') . ': <b>' . $user_stats['suspended'] . '</b>;<br />' . (checkPerm('approve_waiting_user', true, 'directory', 'framework') ? $lang->def('_WAITING_USERS') . ': <b>' . $user_stats['waiting'] . '</b>;' : '') . '</p><p>' . $lang->def('_SUPERADMIN_USER') . ': <b>' . $user_stats['superadmin'] . '</b>;<br />' . $lang->def('_ADMIN_USER') . ': <b>' . $user_stats['admin'] . '</b>;<br />' . $lang->def('_PUBLIC_ADMIN_USER') . ': <b>' . $user_stats['public_admin'] . '</b>;' . '</p><p>' . $lang->def('_REG_TODAY') . ': <b>' . $user_stats['register_today'] . '</b>;<br />' . $lang->def('_REG_YESTERDAY') . ': <b>' . $user_stats['register_yesterday'] . '</b>;<br />' . $lang->def('_REG_LASTSEVENDAYS') . ': <b>' . $user_stats['register_7d'] . '</b>;' . '</p><p>' . $lang->def('_INACTIVE_USER') . ': <b>' . $user_stats['inactive_30d'] . '</b>;<br />' . $lang->def('_ONLINE_USER') . ': <b>' . $user_stats['now_online'] . '</b>;' . '</p><p>' . $lang->def('_CORE_VERSION') . ': <b>' . Get::sett('core_version') . '</b>;<br />' . (Get::sett('welcome_use_feed') == 'on' ? $lang->def('_LAST_RELEASED') . ': ' . $released_version . ';' : '') . '</p>';
return $html;
}
示例7: drawCalendar
function drawCalendar()
{
checkPerm('view');
$size = importVar('size', false, 'max');
$width = "90%";
if ($size == "min") {
$width = "200px";
}
addCss('calendar_' . $size);
YuiLib::load('base,dragdrop');
Util::get_js(Get::rel_path('lms') . '/modules/calendar/calendar.js', true, true);
Util::get_js(Get::rel_path('lms') . '/modules/calendar/calendar_helper.js', true, true);
//permissions = permissions granted to the logged user according to his/her level and role
// 2 => can create/delete/modify all events
// 1 => can create/delete/modify only own events
// 0 => can view only
$permissions = 0;
if (checkPerm('mod', true)) {
$permissions = 2;
} elseif (checkPerm('personal', true)) {
$permissions = 1;
}
//mode="edit" => events can be added and edited according to given permissions
//mode="view" => events can only be viewed regardless the permissions
$GLOBALS['page']->add('<script type="text/javascript">' . ' setup_cal( null, ' . '\'lms\', ' . '\'lms\', ' . '\'edit\', ' . '\'' . $permissions . '\', ' . '\'' . Docebo::user()->getIdSt() . '\' ' . ');' . '</script>', 'page_head');
$GLOBALS['page']->add("\n" . getTitleArea(Lang::t('_CALENDAR', 'calendar'), 'calendar') . '<div class="std_block">' . '<div id="displayCalendar" style="clear: both; width:' . $width . '"></div>' . '<div class="nofloat"></div>' . '</div>', 'content');
}
示例8: init
public function init()
{
parent::init();
$this->json = new Services_JSON();
$this->model = new LangAdm();
$this->perm = array('view' => checkPerm('view', true, 'lang', 'framework'), 'mod' => checkPerm('mod', true, 'lang', 'framework'));
}
示例9: edithtml
function edithtml()
{
checkPerm('mod');
require_once _base_ . '/lib/lib.form.php';
$query = "\r\n\tSELECT textof\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "'";
$re_htmlfront = sql_query($query);
$error = false;
if (isset($_POST['save'])) {
if (mysql_num_rows($re_htmlfront) > 0) {
$upd_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\tSET textof = '" . $_POST['description'] . "'\r\n\t\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "'";
$re = sql_query($upd_query);
} else {
$ins_query = "\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\t( id_course, textof) VALUES \r\n\t\t\t( \t'" . $_SESSION['idCourse'] . "',\r\n\t\t\t\t'" . $_POST['description'] . "' )";
$re = sql_query($ins_query);
}
if ($re) {
Util::jump_to('index.php?modname=htmlfront&op=showhtml&saveok=1');
} else {
$error = true;
}
}
$lang =& DoceboLanguage::createInstance('htmlfront', 'lms');
list($textof) = sql_fetch_row($re_htmlfront);
$title_page = array('index.php?modname=htmlfront&op=showhtml' => $lang->def('_HTMLFRONT'), $lang->def('_MOD'));
$GLOBALS['page']->add(getTitleArea($title_page, 'htmlfront') . '<div class="std_block">' . getBackUi('index.php?modname=htmlfront&op=showhtml', $lang->def('_BACK')) . ($error ? getErrorUi($lang->def('_ERROR_IN_SAVE')) : '') . Form::openForm('formnotes', 'index.php?modname=htmlfront&op=edithtml') . Form::openElementSpace() . Form::getTextarea($lang->def('_TEXTOF'), 'description', 'description', importVar('description', false, $textof)) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例10: uppage
function uppage()
{
checkPerm('view', false, 'storage');
$back_url = urldecode($_POST['back_url']);
$insert_query = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_htmlpage\r\n\tSET title = '" . (trim($_POST['title']) == '' ? Lang::t('_NOTITLE', 'htmlpage', 'lms') : $_POST['title']) . "',\r\n\t\ttextof = '" . $_POST['textof'] . "'\r\n\tWHERE idPage = '" . (int) $_POST['idPage'] . "'";
if (!sql_query($insert_query)) {
$_SESSION['last_error'] = Lang::t('_OPERATION_FAILURE', 'htmlpage', 'lms');
Util::jump_to($back_url . '&mod_result=0');
}
if ($_FILES) {
$n = 0;
foreach ($_FILES as $_FILE) {
$n++;
$file = save_file($_FILE);
if ($file) {
$insert_query = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_htmlpage_attachment SET file = '" . $file . "', title = '" . trim($_FILE['name']) . "', idpage = " . (int) $_POST['idPage'];
sql_query($insert_query);
}
}
}
if ($_POST['iddelattachment'] != '') {
$ids = explode(';', $_POST['iddelattachment']);
foreach ($ids as $id) {
if ($id) {
$query = "DELETE FROM learning_htmlpage_attachment WHERE id = " . $id;
mysql_query($query);
}
}
}
require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
Track_Object::updateObjectTitle($_POST['idPage'], 'htmlpage', $_POST['title']);
Util::jump_to($back_url . '&id_lo=' . $_POST['idPage'] . '&mod_result=1');
}
示例11: addquest
function addquest(&$url)
{
checkPerm('view', false, 'storage');
$lang =& DoceboLanguage::createInstance('test');
$type_quest = Get::pReq('add_test_quest', DOTY_STRING, 'choice');
require_once _lms_ . '/modules/question/question.php';
quest_create($type_quest, 0, $url->getUrl());
}
示例12: init
public function init()
{
parent::init();
require_once _base_ . '/lib/lib.json.php';
$this->json = new Services_JSON();
$this->model = new QuestcategoryAlms();
$this->permissions = array('view' => checkPerm('view', true, 'questcategory', 'lms'), 'add' => true, 'mod' => checkPerm('mod', true, 'questcategory', 'lms'), 'del' => true);
}
示例13: init
public function init()
{
parent::init();
require_once _base_ . '/lib/lib.json.php';
$this->model = new CommunicationAlms();
$this->json = new Services_JSON();
$this->permissions = array('view' => checkPerm('view', true, 'communication', 'lms'), 'add' => checkPerm('mod', true, 'communication', 'lms'), 'mod' => checkPerm('mod', true, 'communication', 'lms'), 'del' => checkPerm('mod', true, 'communication', 'lms'), 'subscribe' => checkPerm('subscribe', true, 'course', 'lms'), 'add_category' => checkPerm('mod', true, 'communication', 'lms'), 'mod_category' => checkPerm('mod', true, 'communication', 'lms'), 'del_category' => checkPerm('mod', true, 'communication', 'lms'));
}
示例14: init
public function init()
{
parent::init();
require_once _base_ . '/lib/lib.json.php';
$this->json = new Services_JSON();
$this->model = new FunctionalrolesAdm();
$this->permissions = array('view' => checkPerm('view', true, 'functionalroles'), 'add' => checkPerm('mod', true, 'functionalroles'), 'mod' => checkPerm('mod', true, 'functionalroles'), 'del' => checkPerm('mod', true, 'functionalroles'), 'associate_user' => checkPerm('associate_user', true, 'functionalroles'));
}
示例15: init
public function init()
{
parent::init();
require_once _base_ . '/lib/lib.json.php';
$this->json = new Services_JSON();
$this->model = new TimeperiodsAlms();
$this->permissions = array('view' => checkPerm('view', true, 'timeperiods', 'lms'), 'add' => checkPerm('mod', true, 'timeperiods', 'lms'), 'mod' => checkPerm('mod', true, 'timeperiods', 'lms'), 'del' => checkPerm('mod', true, 'timeperiods', 'lms'));
}