本文整理汇总了PHP中config::checkRights方法的典型用法代码示例。如果您正苦于以下问题:PHP config::checkRights方法的具体用法?PHP config::checkRights怎么用?PHP config::checkRights使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config
的用法示例。
在下文中一共展示了config::checkRights方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: config
require "class-config.php";
$config = new config("../config/config.php");
// include MPD-lib and connect
require_once 'lib-mpd.php';
$MPD = Net_MPD::factory('Playback', $config->host, intval($config->port), $config->pass);
if (!$MPD->connect()) {
die(json_encode('error'));
}
$status = "success";
// switch ond action
switch ($_GET['action']) {
case 'getCurrentSong':
$status = $MPD->isCommand('currentsong') ? $MPD->getCurrentSong() : array('error');
break;
case 'play':
$config->checkRights("controll_player") && $MPD->isCommand('playid') ? $MPD->playid($_GET['value']) : ($status = "error");
break;
case 'continue':
$config->checkRights("start_playing") && $MPD->isCommand('playid') ? $MPD->playid($_GET['value']) : ($status = "error");
break;
case 'stop':
$config->checkRights("controll_player") && $MPD->isCommand('stop') ? $MPD->stop() : array('error');
break;
case 'pause':
$config->checkRights("pause_playing") && $MPD->isCommand('pause') ? $MPD->pause() : ($status = "error");
break;
case 'random':
$config->checkRights("controll_player") && $MPD->isCommand('random') ? $MPD->random($_GET['value']) : ($status = "error");
break;
case 'repeat':
$config->checkRights("controll_player") && $MPD->isCommand('repeat') ? $MPD->repeat($_GET['value']) : ($status = "error");
示例2: config
// read config
require "class-config.php";
$config = new config("../config/config.php");
if (isset($_SESSION['relaxx']) && $_SESSION['relaxx'] == $config->admin_name && $_SESSION['relaxx_pass'] == $config->admin_pass) {
// include MPD-lib and connect
require_once 'lib-mpd.php';
$MPD = Net_MPD::factory('Admin', $config->host, intval($config->port), $config->pass);
if (!$MPD->connect()) {
echo json_encode('error');
die;
}
// switch ond action
switch ($_GET['action']) {
case 'getOutputs':
$status = $MPD->isCommand('outputs') ? $MPD->getOutputs() : 'error';
break;
case 'disableOutput':
$config->checkRights("admin_mpd") && $MPD->isCommand('disableoutput') ? $MPD->disableOutput($_GET['value']) : ($status = "error");
break;
case 'enableOutput':
$config->checkRights("admin_mpd") && $MPD->isCommand('enableoutput') ? $MPD->enableOutput($_GET['value']) : ($status = "error");
break;
case 'kill':
$config->checkRights("admin_mpd") && $MPD->isCommand('kill') ? $MPD->kill() : ($status = "error");
break;
case 'updateDatabase':
$config->checkRights("admin_mpd") && $MPD->isCommand('update') ? $MPD->updateDatabase($_GET['value']) : ($status = "error");
break;
}
echo json_encode($status);
}
示例3: switch
// switch ond action
switch ($_GET['action']) {
case 'getPlaylistInfo':
$status = $MPD->isCommand('playlistinfo') ? $MPD->getPlaylistInfo($_GET['value']) : 'error';
break;
case 'getPlaylists':
$status = $MPD->isCommand('lsinfo') ? $MPD->getPlaylists() : 'error';
break;
case 'getCurrentSong':
$status = $MPD->isCommand('currentsong') ? $MPD->getCurrentSong() : 'error';
break;
case 'listPlaylistInfo':
$status = $MPD->isCommand('listplaylistinfo') ? $MPD->listPlaylistInfo($_GET['value']) : 'error';
break;
case 'savePlaylist':
$config->checkRights("controll_playlist") && $MPD->isCommand('save') ? $MPD->savePlaylist(strip_tags($_GET['value'])) : ($status = "error");
break;
case 'loadPlaylist':
$config->checkRights("controll_playlist") && $MPD->isCommand('load') ? $MPD->loadPlaylist($_GET['value']) : ($status = "error");
break;
case 'deletePlaylist':
$config->checkRights("controll_playlist") && $MPD->isCommand('rm') ? $MPD->deletePlaylist($_GET['value']) : ($status = "error");
break;
case 'addSong':
$config->checkRights("add_songs") && $MPD->isCommand('add') ? $MPD->addSong($_GET['value']) : ($status = "error");
break;
case 'swapSong':
$pos = split(":", $_GET['value']);
$config->checkRights("controll_playlist") && $MPD->isCommand('swap') ? $MPD->swapSong($pos[0], $pos[1]) : ($status = "error");
break;
case 'moveSong':