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


PHP config::checkRights方法代码示例

本文整理汇总了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");
开发者ID:Gribanovskiy,项目名称:symfony_radio,代码行数:31,代码来源:controller-playback.php

示例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);
}
开发者ID:cavewebs,项目名称:mywebradio,代码行数:31,代码来源:controller-mpdadmin.php

示例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':
开发者ID:cavewebs,项目名称:mywebradio,代码行数:31,代码来源:controller-playlist.php


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