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


PHP api_protect_admin_script函数代码示例

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


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

示例1: __construct

 function __construct($title = '')
 {
     global $this_section;
     $this_section = SECTION_PLATFORM_ADMIN;
     api_protect_admin_script();
     if (empty($title)) {
         $title = get_lang(get_class($this));
     }
     $this->title = $title;
     $this->breadcrumbs = array();
     $this->breadcrumbs[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:12,代码来源:admin_page.class.php

示例2: protect_script

	/**
	 *  Validates the access to a certain reservation-script
	 *
	 *  @param  -   String  $section    The section (= script-file)
	 *  @param  -   int     $id         An id (sometimes this is required to get rights for a unique row in the database)
	 */
	function protect_script($section, $id = null) {
		$uid = api_get_user_id();
		switch ($section) {
			case 'm_item' :
				if (!api_is_platform_admin() && Rsys :: check_user_status() <> 1)
					api_protect_admin_script();
				break;
			case 'm_category' :
				api_protect_admin_script();
				break;
			case 'm_reservation' :
				if (!api_is_platform_admin() && Rsys :: check_user_status() <> 1)
					api_protect_admin_script();
				break;
		}
	}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:22,代码来源:rsys.php

示例3: api_protect_admin_script

/**
*	This script allows platform admins to add users to courses.
*	It displays a list of users and a list of courses;
*	you can select multiple users and courses and then click on
*	'Add to this(these) course(s)'.
*
*	@package chamilo.admin
* 	@todo use formvalidator for the form
*/
/* INIT SECTION */
// name of the language file that needs to be included
$language_file = 'admin';
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
/* Global constants and variables */
$form_sent = 0;
$first_letter_user = '';
$first_letter_course = '';
$courses = array();
$users = array();
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
/* Header */
$tool_name = get_lang('AddUsersToACourse');
$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
$htmlHeadXtra[] = '
<script type="text/javascript">
function validate_filter() {
        document.formulaire.form_sent.value=0;
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:subscribe_user2course.php

示例4: api_protect_admin_script

<?php

/* For licensing terms, see /license.txt */
/**
 * Index page of the admin tools
 * @package chamilo.admin
 */
// Resetting the course id.
$cidReset = true;
// Including some necessary chamilo files.
require_once '../inc/global.inc.php';
// Setting the section (for the tabs).
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions.
api_protect_admin_script(true);
$nameTools = get_lang('PlatformAdmin');
$accessUrlId = 0;
$adminExtraContentDir = api_get_path(SYS_PATH) . "home/admin/";
if (api_is_multiple_url_enabled()) {
    $accessUrlId = api_get_current_access_url_id();
    if ($accessUrlId != -1) {
        $urlInfo = api_get_access_url($accessUrlId);
        $url = api_remove_trailing_slash(preg_replace('/https?:\\/\\//i', '', $urlInfo['url']));
        $cleanUrl = str_replace('/', '-', $url);
        $adminExtraContentDir = api_get_path(SYS_PATH) . "home/{$cleanUrl}/admin/";
    }
}
// Displaying the header
$message = '';
if (api_is_platform_admin()) {
    if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:index.php

示例5: parse_xml_data

 * @return array All user information read from the file
 */
function parse_xml_data($file)
{
    global $users;
    $users = array();
    $parser = xml_parser_create('UTF-8');
    xml_set_element_handler($parser, 'element_start', 'element_end');
    xml_set_character_data_handler($parser, 'character_data');
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
    xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
    xml_parser_free($parser);
    return $users;
}
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true, null, 'login');
$defined_auth_sources[] = PLATFORM_AUTH_SOURCE;
if (isset($extAuthSource) && is_array($extAuthSource)) {
    $defined_auth_sources = array_merge($defined_auth_sources, array_keys($extAuthSource));
}
$tool_name = get_lang('ImportUserListXMLCSV');
$interbreadcrumb[] = array('url' => Container::getRouter()->generate('administration'), "name" => get_lang('PlatformAdmin'));
set_time_limit(0);
$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', true);
$user_id_error = array();
$error_message = '';
if (isset($_POST['formSent']) && $_POST['formSent'] and $_FILES['import_file']['size'] !== 0) {
    $file_type = 'csv';
    Security::clear_token();
    $tok = Security::get_token();
    $allowed_file_mimetype = array('csv', 'xml');
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:user_update_import.php

示例6: api_protect_admin_script

<?php

/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(false, true);
if (api_get_setting('skill.allow_skills_tool') != 'true') {
    api_not_allowed();
}
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_js('js/d3/d3.v3.5.4.min.js');
$htmlHeadXtra[] = api_get_js('js/d3/colorbrewer.js');
$htmlHeadXtra[] = api_get_js('js/d3/jquery.xcolor.js');
$tpl = Container::getTwig();
$load_user = 0;
if (isset($_GET['load_user'])) {
    $load_user = 1;
}
$skill_condition = '';
$tpl->addGlobal('skill_id_to_load', '');
if (isset($_GET['skill_id'])) {
    $skillId = intval($_GET['skill_id']);
    $skill_condition = '&skill_id=' . $skillId;
    $tpl->addGlobal('skill_id_to_load', $skillId);
}
$url = api_get_path(WEB_AJAX_PATH) . "skill.ajax.php?a=get_skills_tree_json&load_user={$load_user}";
$tpl->addGlobal('wheel_url', $url);
$url = api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php?1=1';
$tpl->addGlobal('url', $url);
$tpl->addGlobal('isAdministration', true);
$dialogForm = new FormValidator('form', 'post', null, null, ['id' => 'add_item']);
开发者ID:daffef,项目名称:chamilo-lms,代码行数:31,代码来源:skills_wheel.php

示例7: protect_session_edit

    /**
     * Protect a session to be edited.
     * @param int $id
     */
    static function protect_session_edit($id)
    {
        api_protect_admin_script(true);
        $session_info = self::fetch($id);

        if (empty($session_info)) {
            api_not_allowed(true);
        }
        if (!api_is_platform_admin() &&
            api_get_setting('allow_session_admins_to_manage_all_sessions') != 'true'
        ) {
            if ($session_info['session_admin_id'] != api_get_user_id()) {
                api_not_allowed(true);
            }
        }
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:20,代码来源:sessionmanager.lib.php

示例8: indexAction

 /**
  * @param Application $app
  * @return string
  */
 public function indexAction(Application $app)
 {
     $request = $app['request'];
     $language_file = array('admin', 'exercice', 'gradebook', 'tracking');
     // 1. Setting variables needed by jqgrid
     $action = $request->get('a');
     $page = $request->get('page');
     //page
     $limit = $request->get('rows');
     //quantity of rows
     $sidx = $request->get('sidx');
     //index (field) to filter
     $sord = $request->get('sord');
     //asc or desc
     if (strpos(strtolower($sidx), 'asc') !== false) {
         $sidx = str_replace(array('asc', ','), '', $sidx);
         $sord = 'asc';
     }
     if (strpos(strtolower($sidx), 'desc') !== false) {
         $sidx = str_replace(array('desc', ','), '', $sidx);
         $sord = 'desc';
     }
     if (!in_array($sord, array('asc', 'desc'))) {
         $sord = 'desc';
     }
     if (!in_array($action, array('get_exercise_results', 'get_hotpotatoes_exercise_results', 'get_work_user_list', 'get_timelines', 'get_user_skill_ranking', 'get_usergroups_teacher', 'get_question_list', 'get_user_list_plugin_widescale'))) {
         api_protect_admin_script(true);
     }
     if ($action == 'get_user_list_plugin_widescale') {
         $allowed = api_is_drh() || api_is_platform_admin();
         if (!$allowed) {
             api_not_allowed();
         }
     }
     // Search features.
     // If there is no search request sent by jqgrid, $where should be empty.
     $where_condition = "";
     $operation = $request->get('oper');
     $export_format = $request->get('export_format');
     $search_field = $request->get('searchField');
     $search_oper = $request->get('searchOper');
     $search_string = $request->get('searchString');
     $isSearch = $request->get('_search');
     $filters = $request->get('filters');
     $type = $request->get('type');
     $extra_fields = array();
     $questionFields = array();
     if ($isSearch == 'true') {
         $where_condition = ' 1 = 1 ';
         $where_condition_in_form = $this->getWhereClause($search_field, $search_oper, $search_string);
         if (!empty($where_condition_in_form)) {
             $where_condition .= ' AND ' . $where_condition_in_form;
         }
         $filters = isset($filters) ? json_decode($filters) : false;
         // for now
         if (!empty($filters)) {
             switch ($action) {
                 case 'get_questions':
                     $extraFieldtype = 'question';
                     break;
                 case 'get_sessions':
                     $extraFieldtype = 'session';
                     break;
             }
             // Extra field.
             $extraField = new \ExtraField($extraFieldtype);
             $result = $extraField->getExtraFieldRules($filters, 'extra_');
             $extra_fields = $result['extra_fields'];
             $condition_array = $result['condition_array'];
             if (!empty($condition_array)) {
                 $where_condition .= ' AND ( ';
                 $where_condition .= implode($filters->groupOp, $condition_array);
                 $where_condition .= ' ) ';
             }
             // Question field.
             $resultQuestion = $extraField->getExtraFieldRules($filters, 'question_');
             $questionFields = $resultQuestion['extra_fields'];
             $condition_array = $resultQuestion['condition_array'];
             if (!empty($condition_array)) {
                 $where_condition .= ' AND ( ';
                 $where_condition .= implode($filters->groupOp, $condition_array);
                 $where_condition .= ' ) ';
             }
         }
     }
     // get index row - i.e. user click to sort $sord = $_GET['sord'];
     // get the direction
     if (!$sidx) {
         $sidx = 1;
     }
     //2. Selecting the count FIRST
     //@todo rework this
     switch ($action) {
         case 'get_questions':
             $categoryId = $request->get('categoryId');
             $exerciseId = $request->get('exerciseId');
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:ModelAjaxController.php

示例9: loadAdminMenu

 /**
  * Move in template.lib
  */
 private function loadAdminMenu()
 {
     $template = $this->get('template');
     // Access restrictions.
     api_protect_admin_script(true);
     // @todo fix register/check version
     $message = null;
     if (!empty($_POST['Register'])) {
         register_site();
         $message = \Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation');
     }
     $blocks = array();
     $adminUrl = api_get_path(WEB_CODE_PATH) . 'admin/';
     /* Users */
     $blocks['users']['icon'] = \Display::return_icon('members.gif', get_lang('Users'), array(), ICON_SIZE_SMALL, false);
     $blocks['users']['label'] = api_ucfirst(get_lang('Users'));
     if (api_is_platform_admin()) {
         $search_form = $this->getSearchForm($adminUrl . 'user_list.php')->return_form();
         $blocks['users']['search_form'] = $search_form;
         $items = array(array('url' => $adminUrl . 'user_list.php', 'label' => get_lang('UserList')), array('url' => $adminUrl . 'user_add.php', 'label' => get_lang('AddUsers')), array('url' => $adminUrl . 'user_export.php', 'label' => get_lang('ExportUserListXMLCSV')), array('url' => $adminUrl . 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')));
         if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
             $items[] = array('url' => $adminUrl . 'ldap_users_list.php', 'label' => get_lang('ImportLDAPUsersIntoPlatform'));
         }
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=user', 'label' => get_lang('ManageUserFields'));
         $items[] = array('url' => api_get_path(WEB_PUBLIC_PATH) . 'admin/administrator/roles', 'label' => get_lang('Roles'));
     } else {
         $items = array(array('url' => $adminUrl . 'user_list.php', 'label' => get_lang('UserList')), array('url' => $adminUrl . 'user_add.php', 'label' => get_lang('AddUsers')), array('url' => $adminUrl . 'user_import.php', 'label' => get_lang('ImportUserListXMLCSV')));
     }
     $blocks['users']['items'] = $items;
     $blocks['users']['extra'] = null;
     if (api_is_platform_admin()) {
         /* Courses */
         $blocks['courses']['icon'] = \Display::return_icon('course.gif', get_lang('Courses'), array(), ICON_SIZE_MEDIUM, false);
         $blocks['courses']['label'] = api_ucfirst(get_lang('Courses'));
         $search_form = $this->getSearchForm($adminUrl . 'course_list.php')->return_form();
         $blocks['courses']['search_form'] = $search_form;
         $items = array();
         $items[] = array('url' => $adminUrl . 'course_list.php', 'label' => get_lang('CourseList'));
         if (api_get_setting('course_validation') != 'true') {
             $items[] = array('url' => $adminUrl . 'course_add.php', 'label' => get_lang('AddCourse'));
         } else {
             $items[] = array('url' => $adminUrl . 'course_request_review.php', 'label' => get_lang('ReviewCourseRequests'));
             $items[] = array('url' => $adminUrl . 'course_request_accepted.php', 'label' => get_lang('AcceptedCourseRequests'));
             $items[] = array('url' => $adminUrl . 'course_request_rejected.php', 'label' => get_lang('RejectedCourseRequests'));
         }
         $items[] = array('url' => $adminUrl . 'course_export.php', 'label' => get_lang('ExportCourses'));
         $items[] = array('url' => $adminUrl . 'course_import.php', 'label' => get_lang('ImportCourses'));
         $items[] = array('url' => $adminUrl . 'course_category.php', 'label' => get_lang('AdminCategories'));
         $items[] = array('url' => $adminUrl . 'subscribe_user2course.php', 'label' => get_lang('AddUsersToACourse'));
         $items[] = array('url' => $adminUrl . 'course_user_import.php', 'label' => get_lang('ImportUsersToACourse'));
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=course', 'label' => get_lang('ManageCourseFields'));
         $items[] = array('url' => $adminUrl . 'extra_fields.php?type=question', 'label' => get_lang('ManageQuestionFields'));
         if (api_get_setting('gradebook_enable_grade_model') == 'true') {
             $items[] = array('url' => $adminUrl . 'grade_models.php', 'label' => get_lang('GradeModel'));
         }
         if (isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap']) > 0) {
             $items[] = array('url' => $adminUrl . 'ldap_import_students.php', 'label' => get_lang('ImportLDAPUsersIntoCourse'));
         }
         $blocks['courses']['items'] = $items;
         $blocks['courses']['extra'] = null;
         /* Platform */
         $blocks['platform']['icon'] = \Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
         $blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
         $form = $this->getSearchForm($adminUrl . 'settings.php');
         $form->addElement('hidden', 'category', 'search_setting');
         $search_form = $form->return_form();
         $blocks['platform']['search_form'] = $search_form;
         $items = array();
         $items[] = array('url' => $adminUrl . 'settings.php', 'label' => get_lang('PlatformConfigSettings'));
         $items[] = array('url' => $adminUrl . 'settings.php?category=Plugins', 'label' => get_lang('Plugins'));
         $items[] = array('url' => $adminUrl . 'settings.php?category=Regions', 'label' => get_lang('Regions'));
         $items[] = array('url' => $adminUrl . 'system_announcements.php', 'label' => get_lang('SystemAnnouncements'));
         $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'calendar/agenda_js.php?type=admin', 'label' => get_lang('GlobalAgenda'));
         $items[] = array('url' => $adminUrl . 'configure_homepage.php', 'label' => get_lang('ConfigureHomePage'));
         $items[] = array('url' => $adminUrl . 'configure_inscription.php', 'label' => get_lang('ConfigureInscription'));
         $items[] = array('url' => $adminUrl . 'statistics/index.php', 'label' => get_lang('Statistics'));
         $items[] = array('url' => api_get_path(WEB_CODE_PATH) . 'mySpace/company_reports.php', 'label' => get_lang('Reports'));
         /* Event settings */
         if (api_get_setting('activate_email_template') == 'true') {
             $items[] = array('url' => $adminUrl . 'event_controller.php?action=listing', 'label' => get_lang('EventMessageManagement'));
         }
         if (api_get_multiple_access_url()) {
             if (api_is_global_platform_admin()) {
                 $items[] = array('url' => $adminUrl . 'access_urls.php', 'label' => get_lang('ConfigureMultipleAccessURLs'));
             }
         }
         if (api_get_setting('allow_reservation') == 'true') {
             //$items[] = array('url' => $adminUrl.'../reservation/m_category.php', 	'label' => get_lang('BookingSystem'));
         }
         if (api_get_setting('allow_terms_conditions') == 'true') {
             $items[] = array('url' => $adminUrl . 'legal_add.php', 'label' => get_lang('TermsAndConditions'));
         }
         $blocks['platform']['items'] = $items;
         $blocks['platform']['extra'] = null;
     }
     /* Sessions */
     $blocks['sessions']['icon'] = \Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_SMALL, false);
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:AdminController.php


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