示例#1
0
function getNamePlsByID($id_user, $name)
{
    $sql = "select id from user_playlist where id_user = '******' and name = '{$name}'";
    $qr = mysql_query($sql) or die(mysql_error());
    if (mysql_num_rows($qr) > 0) {
        $res = mysql_fetch_assoc($qr);
        $id = $res["id"];
    } else {
        $id = -1;
    }
    return $id;
}
// Добавляем каталог в базу
if ($_POST["action"] == "add_folder") {
    $path = $_POST["path"];
    if (addFolder($path)) {
        echo "true";
    } else {
        echo "false";
    }
}
if ($_POST["action"] == "get_count") {
    $id_user = $_POST["id_user"];
    $id_track = $_POST["id_track"];
    $sql = "select my.count myCount,allUsers.count allCount\r\n\t\t\tfrom\r\n\t\t\t(select count from counts where id_user = '******' and id_track = '{$id_track}') my,\r\n\t\t\t(select sum(count) count  from counts where id_track = '{$id_track}') allUsers";
    $res = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_assoc($res);
    // if(count($row)>0)
    // $myCount  = $row["myCount"];
    // $allCount = $row["allCount"];
    // echo "get_count";
示例#2
0
 // Displaying the form to edit a folder language info
 case "modtext":
     $folderid = isset($_GET['folderid']) ? intval($_GET['folderid']) : 0;
     $languageid = isset($_GET['languageid']) ? $_GET['languageid'] : 'new';
     xoops_cp_header();
     editfolder_text(true, $folderid, $languageid);
     break;
     // Adding or editing a folder in the db
 // Adding or editing a folder in the db
 case "addfolder":
     addFolder(false);
     break;
     // Adding or editing a folder language info in the db
 // Adding or editing a folder language info in the db
 case "addfolder_text":
     addFolder(true);
     break;
     // deleting a folder
 // deleting a folder
 case "del":
     global $smartmedia_folder_handler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET;
     $module_id = $xoopsModule->getVar('mid');
     $gperm_handler =& xoops_gethandler('groupperm');
     $folderid = isset($_POST['folderid']) ? intval($_POST['folderid']) : 0;
     $folderid = isset($_GET['folderid']) ? intval($_GET['folderid']) : $folderid;
     $categoryid = isset($_POST['categoryid']) ? intval($_POST['categoryid']) : 0;
     $categoryid = isset($_GET['categoryid']) ? intval($_GET['categoryid']) : $categoryid;
     $folderObj = $smartmedia_folder_handler->get($folderid);
     // Check to see if this item has children
     if ($folderObj->hasChild()) {
         redirect_header("folder.php", 3, _AM_SMEDIA_FOLDER_CANNOT_DELETE_HAS_CHILD);
示例#3
0
function controlFile($id)
{
    $app = Slim\Slim::getInstance();
    $app->contentType('application/json');
    $server = $id[0];
    $path = implode("/", array_slice($id, 1));
    if (!$path) {
        $path = "/";
    } else {
        $path = "/" . $path;
    }
    $id = implode("/", $id);
    $file = getOption('root') . '/' . $id;
    $request = $app->request();
    $control = $request->getBody();
    $response = $app->response();
    $result = "error";
    if (is_file($file)) {
        switch ($control["command"]) {
            case "play":
                $result = play($file);
                break;
            case "add":
                $result = addFile($file);
                break;
            case "remove":
                $result = removeFile($file);
                break;
            default:
                $result = "illegal command";
                $response->status(400);
                break;
        }
    } else {
        if (is_dir($file)) {
            switch ($control["command"]) {
                case "play":
                    $result = playFolder($file);
                    break;
                case "add":
                    $result = addFolder($file);
                    break;
                case "remove":
                    $result = removeFolder($file);
                    break;
                case "search":
                    return search($server, "/_search/" . $control["value"]);
                default:
                    $result = "illegal command";
                    $response->status(400);
                    break;
            }
        } else {
            $response->status(404);
        }
    }
    $body = array();
    $body['command'] = $control["command"];
    $body['result'] = $result;
    echo json_encode($body);
}