本文整理汇总了PHP中Access::check方法的典型用法代码示例。如果您正苦于以下问题:PHP Access::check方法的具体用法?PHP Access::check怎么用?PHP Access::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Access
的用法示例。
在下文中一共展示了Access::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: teacherController
function teacherController()
{
if (!Access::check('teacher')) {
abort404();
}
view('teachers');
}
示例2: studentController
function studentController()
{
if (!Access::check('student')) {
abort404();
}
view('students');
}
示例3: 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');
}
}
示例4: 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();
}
示例5: action_client
/**
* страница работы с клиентом
*/
public function action_client()
{
$clientId = $this->request->param('id');
Access::check('client', $clientId);
$client = Model_Client::getClient($clientId);
$contracts = Model_Contract::getContracts($clientId);
if (empty($client)) {
throw new HTTP_Exception_404();
}
$popupContractAdd = Common::popupForm('Добавление нового договора', 'contract/add');
$popupCabinetCreate = Common::popupForm('Создание личного кабинета', 'client/cabinet_create');
$this->tpl->bind('client', $client)->bind('contracts', $contracts)->bind('popupContractAdd', $popupContractAdd)->bind('popupCabinetCreate', $popupCabinetCreate);
}
示例6: debug_event
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once 'lib/init.php';
if (!isset($_REQUEST['action']) || empty($_REQUEST['action'])) {
debug_event("stream.php", "Asked without action. Exiting...", 5);
exit;
}
if (!defined('NO_SESSION')) {
/* If we are running a demo, quick while you still can! */
if (AmpConfig::get('demo_mode') || !Access::check('interface', '25')) {
UI::access_denied();
exit;
}
}
$media_ids = array();
$web_path = AmpConfig::get('web_path');
debug_event("stream.php", "Asked for {" . $_REQUEST['action'] . "}.", 5);
/**
* action switch
*/
switch ($_REQUEST['action']) {
case 'basket':
// Pull in our items (multiple types)
$media_ids = $GLOBALS['user']->playlist->get_items();
// Check to see if 'clear' was passed if it was then we need to reset the basket
示例7: array
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2015 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../../lib/class/plex_xml_data.class.php';
$ow_config = array('http_host' => $_SERVER["SERVER_NAME"] . ':' . $_SERVER["SERVER_PORT"], 'web_path' => '/web');
require_once '../../lib/init.php';
if (!AmpConfig::get('plex_backend')) {
echo "Disabled.";
exit;
}
if (!defined('NO_SESSION') && !Access::check('interface', '100')) {
echo T_('Unauthorized.');
exit;
}
示例8: T_
if (Access::check_function('batch_download') && check_can_zip('playlist')) {
?>
<a rel="nohtml" href="<?php
echo AmpConfig::get('web_path');
?>
/batch.php?action=playlist&id=<?php
echo $libitem->id;
?>
">
<?php
echo UI::get_icon('batch_download', T_('Batch Download'));
?>
</a>
<?php
}
if (Access::check('interface', '25')) {
if (AmpConfig::get('share')) {
Share::display_ui('playlist', $libitem->id, false);
}
}
if ($libitem->has_access()) {
?>
<a id="<?php
echo 'edit_playlist_' . $libitem->id;
?>
" onclick="showEditDialog('playlist_row', '<?php
echo $libitem->id;
?>
', '<?php
echo 'edit_playlist_' . $libitem->id;
?>
示例9: downloadpodcastepisode
/**
* downloadPodcastEpisode
* Request the server to download a podcast episode
* Takes the podcast episode id in parameter.
*/
public static function downloadpodcastepisode($input)
{
self::check_version($input, "1.9.0");
$id = self::check_parameter($input, 'id');
if (AmpConfig::get('podcast') && Access::check('interface', 75)) {
$episode = new Podcast_Episode(Subsonic_XML_Data::getAmpacheId($id));
if ($episode->id) {
$episode->gather();
$r = Subsonic_XML_Data::createSuccessResponse();
} else {
$r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
}
} else {
$r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
}
self::apiOutput($input, $r);
}
示例10: filesize
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface', 100) or AmpConfig::get('demo_mode')) {
UI::access_denied();
exit;
}
UI::show_header();
/* Switch on action boys */
switch ($_REQUEST['action']) {
/* This re-generates the config file comparing
* /config/ampache.cfg to .cfg.dist
*/
case 'generate_config':
ob_end_clean();
$current = parse_ini_file(AmpConfig::get('prefix') . '/config/ampache.cfg.php');
$final = generate_config($current);
$browser = new Horde_Browser();
$browser->downloadHeaders('ampache.cfg.php', 'text/plain', false, filesize(AmpConfig::get('prefix') . '/config/ampache.cfg.php.dist'));
示例11: changepassword
/**
* changePassword
* Change the password of an existing user.
* Takes the username with new password in parameters.
*/
public static function changepassword($input)
{
self::check_version($input, "1.1.0");
$username = self::check_parameter($input, 'username');
$password = self::check_parameter($input, 'password');
$password = self::decrypt_password($password);
if ($GLOBALS['user']->username == $username || Access::check('interface', 100)) {
$user = User::get_from_username($username);
if ($user->id) {
$user->update_password($password);
$r = Subsonic_XML_Data::createSuccessResponse();
} else {
$r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
}
} else {
$r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
}
self::apiOutput($input, $r);
}
示例12: T_
</th>
<?php
if (AmpConfig::get('track_user_ip')) {
?>
<th class="cel_lastip"><?php
echo T_('Last Ip');
?>
</th>
<?php
}
?>
<?php
}
?>
<?php
if (Access::check('interface', 25) && AmpConfig::get('sociable')) {
?>
<th class="cel_follow"><?php
echo T_('Following');
?>
</th>
<?php
}
?>
<th class="cel_action"><?php
echo T_('Action');
?>
</th>
<th class="cel_online"><?php
echo T_('On-line');
?>
示例13: T_
echo Ajax::observe('artist_select_1', 'change', 'check_inline_song_edit("artist", 1)');
?>
</div>
</td>
</tr>
<?php
}
?>
<tr>
<td class="edit_dialog_content_header"><?php
echo T_('Album');
?>
</td>
<td>
<?php
show_album_select('album', $album, true, 1, Access::check('interface', 50), Access::check('interface', 50) ? null : $GLOBALS['user']->id);
?>
<div id="album_select_upload_1">
<?php
echo Ajax::observe('album_select_1', 'change', 'check_inline_song_edit("album", 1)');
?>
</div>
</td>
</tr>
<?php
if (AmpConfig::get('licensing')) {
?>
<tr>
<td class="edit_dialog_content_header"><?php
echo T_('Music License');
?>
示例14: T_
} else {
$title = T_('Subscribed to Podcast');
$body = '';
show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=podcast');
}
break;
case 'delete':
if (!Access::check('interface', 75) || AmpConfig::get('demo_mode')) {
UI::access_denied();
exit;
}
$podcast_id = scrub_in($_REQUEST['podcast_id']);
show_confirmation(T_('Podcast Deletion'), T_('Are you sure you want to delete this podcast?'), AmpConfig::get('web_path') . "/podcast.php?action=confirm_delete&podcast_id=" . $podcast_id, 1, 'delete_podcast');
break;
case 'confirm_delete':
if (!Access::check('interface', 75) || AmpConfig::get('demo_mode')) {
UI::access_denied();
exit;
}
$podcast = new Podcast($_REQUEST['podcast_id']);
if ($podcast->remove()) {
show_confirmation(T_('Podcast Deletion'), T_('Podcast has been deleted.'), AmpConfig::get('web_path') . '/browse.php?action=podcast');
} else {
show_confirmation(T_('Podcast Deletion'), T_('Cannot delete this podcast.'), AmpConfig::get('web_path') . '/browse.php?action=podcast');
}
break;
case 'show':
$podcast_id = intval($_REQUEST['podcast']);
if ($podcast_id > 0) {
$podcast = new Podcast($podcast_id);
$podcast->format();
示例15: isset
</span><img src="<?php
echo AmpConfig::get('web_path') . AmpConfig::get('theme_path');
?>
/images/icons/icon_all.png" class="header-img <?php
echo isset($_COOKIE['sb_localplay']) ? $_COOKIE['sb_localplay'] : 'expanded';
?>
" id="localplay" alt="<?php
echo T_('Expand/Collapse');
?>
" title="<?php
echo T_('Expand/Collapse');
?>
" /></h4>
<ul class="sb3" id="sb_localplay_info">
<?php
if (Access::check('localplay', '75')) {
?>
<li id="sb_localplay_info_add_instance"><a href="<?php
echo $web_path;
?>
/localplay.php?action=show_add_instance"><?php
echo T_('Add Instance');
?>
</a></li>
<li id="sb_localplay_info_show_instances"><a href="<?php
echo $web_path;
?>
/localplay.php?action=show_instances"><?php
echo T_('Show instances');
?>
</a></li>