예제 #1
0
function startElement($parser, $name, $attrs)
{
    global $id, $file, $xrai_db, $db_filestatus, $db_pools, $poolid, $poolstate, $userid, $poolname;
    if ($name == "pool") {
        $id = $attrs["topic"];
        if (!$id) {
            die("No topic id defined!\n");
        }
        $poolid = $xrai_db->nextId("{$db_pools}_id");
        if (DB::isError($poolid)) {
            die($poolid->getUserInfo() . "\n");
        }
        $res = $xrai_db->autoExecute("{$db_pools}", array("id" => $poolid, "idtopic" => $id, "login" => $userid, "name" => $poolname, "state" => $poolstate, "enabled" => "t"));
        if (DB::isError($res)) {
            die($res->getUserInfo() . "\n");
        }
        return;
    }
    if (!$id) {
        die("No topic id defined!\n");
    }
    switch ($name) {
        case "file":
            $file = getFileId($attrs["file"]);
            if ($file > 0) {
                $res = $xrai_db->autoExecute($db_filestatus, array("idfile" => $file, "idpool" => $poolid, "status" => "0", "inpool" => "t", "version" => 1));
                if (DB::isError($res)) {
                    die($res->getUserInfo() . "\n");
                }
            }
            break;
        case "path":
            break;
        default:
            die("Unexpected tag: {$name}");
    }
}
function startElement($parser, $name, $attrs)
{
    global $id, $file, $xrai_db, $db_topicelements;
    if ($name == "pool") {
        $id = $attrs["topic"];
        if (!$id) {
            die("No topic id defined!\n");
        }
        $res = $xrai_db->query("DELETE FROM {$db_topicelements} WHERE idtopic=?", array($id));
        if (DB::isError($res)) {
            die($res->getUserInfo() . "\n");
        }
        return;
    }
    if (!$id) {
        die("No topic id defined!\n");
    }
    switch ($name) {
        case "file":
            $file = getFileId($attrs["file"]);
            break;
        case "path":
            $pathid = getPathId($attrs["path"]);
            if ($file > 0 && $pathid > 0) {
                print "Adding {$file}, {$path}\n";
                $res = $xrai_db->autoExecute($db_topicelements, array("idfile" => $file, "idtopic" => $id, "idpath" => $pathid));
                if (DB::isError($res)) {
                    die($res->getUserInfo() . "\n");
                }
            } else {
                print "Skipping {$file}, {$pathid}\n";
            }
            break;
        default:
            die("Unexpected tag: {$name}");
    }
}
function startElement($parser, $name, $attrs)
{
    global $filepath, $id, $file, $xrai_db, $db_topicelements;
    if ($name == "pool") {
        $id = $attrs["topic"];
        if (!$id) {
            die("No topic id defined!\n");
        }
        $res = $xrai_db->query("DELETE FROM {$db_topicelements} WHERE idtopic=?", array($id));
        if (DB::isError($res)) {
            die($res->getUserInfo() . "\n");
        }
        return;
    }
    if (!$id) {
        die("No topic id defined!\n");
    }
    switch ($name) {
        case "file":
            $filepath = $attrs["file"];
            $file = getFileId($attrs["file"]);
            break;
        case "passage":
            if ($attrs["start"] && $attrs["end"]) {
                $startid = getPathId(normalisePath($attrs["start"]));
                $endid = getPathId(normalisePath($attrs["end"]));
                if ($file > 0 && $startid > 0 && $endid > 0) {
                    print "Adding passage {$file}, {$startid}, {$endid} ({$filepath}, {$attrs['start']}, {$attrs['end']})\n";
                    $res = $xrai_db->autoExecute($db_topicelements, array("idfile" => $file, "idtopic" => $id, "idstartpath" => $startid, "idendpath" => $endid));
                    if (DB::isError($res)) {
                        print "[ERROR: " . $res->getUserInfo() . "] Skipping {$file}, {$pathid}\n";
                    }
                } else {
                    print "[ERROR] Skipping {$file}, {$pathid} (file and/or start/end path are not valid)\n";
                }
            } else {
                print "[ERROR] Skipping {$file}, {$pathid} (no start/end attributes for a passage)\n";
            }
            break;
        case "path":
            if ($attrs["path"]) {
                $pathid = getPathId($attrs["path"]);
                if ($file > 0 && $pathid > 0) {
                    print "Adding element {$file}, {$pathid} ({$filepath}, {$attrs['path']})\n";
                    $res = $xrai_db->autoExecute($db_topicelements, array("idfile" => $file, "idtopic" => $id, "idstartpath" => $pathid, "idendpath" => $pathid));
                    if (DB::isError($res)) {
                        print "[ERROR: " . $res->getUserInfo() . "] Skipping {$file}, {$pathid}\n";
                    }
                    // die($res->getUserInfo() . "\n");
                } else {
                    print "[ERROR] Skipping {$file}, {$pathid} (file and/or path are not valid)\n";
                }
            } else {
                print "[ERROR] Skipping {$file}, {$pathid}\n";
            }
            break;
        default:
            die("Unexpected tag: {$name}");
    }
}
예제 #4
0
<?php

header('Content-type: application/json');
chdir("../..");
chdir("database");
require_once "files.php";
chdir("..");
require_once "configuration.php";
/**
 * DESCRIPTION: Gets the file id from the database
 * PARAMETERS: api/files/getId.php <apikey> <path> <user>
 */
if (isset($_GET['apikey']) and isset($_GET['path']) and isset($_GET['user'])) {
    $auth = (string) $_GET['apikey'];
    if ($auth != $apikey) {
        echo json_encode(array("result" => "permissionDenied"));
    } else {
        $path = (string) $_GET['path'];
        $user = (string) $_GET['user'];
        if (fileExists($path, $user)) {
            $id = getFileId($user, $path);
            echo json_encode(array("result" => "ok", "id" => $id));
        } else {
            echo json_encode(array("result" => "invalidFile"));
        }
    }
} else {
    echo json_encode(array("result" => "missingParams"));
}
예제 #5
0
function startElement($parser, $name, $attrs)
{
    global $currentdir, $files, $paths, $rankcounts, $status, $pre;
    switch ($name) {
        case "subcollection":
            $pre++;
            $olddir = $currentdir;
            $path = "{$currentdir}/{$attrs['path']}";
            if (!is_file($path)) {
                if (is_dir("{$path}")) {
                    $path .= "/index.xrai";
                }
            }
            if (!is_file($path)) {
                die("Can't find subcollection with path {$path} (search for {$path}{.xrai,index,})\n");
            }
            $currentdir = dirname($path);
            print "Parsing {$path}\n";
            $name = get_name("{$olddir}/{$attrs['path']}");
            array_push($files, array("id" => getFileId($name), "title" => "", "path" => $name, "type" => "xrai", "pre" => $pre));
            parse($path);
            $currentdir = $olddir;
            $status = 1;
            break;
        case "document":
            $pre++;
            $path = "{$currentdir}/{$attrs['path']}.xml";
            print "Parsing {$path}\n";
            array_push($rankcounts, array());
            array_push($paths, "");
            $name = get_name("{$path}");
            array_push($files, array("id" => getFileId($name), "title" => "", "path" => $name, "type" => "xml", "pre" => $pre));
            parseXML($path);
            array_pop($rankcounts);
            array_pop($paths);
            $status = 1;
            break;
        default:
            $status = 0;
    }
}
예제 #6
0
            $i++;
            $filename = $_SERVER["DOCUMENT_ROOT"] . UPLOAD_FILES_DIR . "/customers/{$i}_" . cmsUTF_encode($form->files["order_file"]["name"]);
        }
        if (@move_uploaded_file($form->files["order_file"]["tmp_name"], $filename)) {
            //$form->alert('перекинул');
            $fileid = getFileId(cmsUTF_decode($filename));
        } else {
            $form->alert("Не удалось сохранить файл! Попробуйте еще.");
            $form->processed();
            exit;
        }
    } else {
        //$form->alert('Нет файлов');
        // линк получить
        if ($form->request["curfile"] != 'None') {
            $fileid = getFileId($_SERVER["DOCUMENT_ROOT"] . "/customers/ordersfile/" . $form->request["curfile"]);
        }
    }
    if ($edit) {
        // редактирование
        $sql = "UPDATE orders SET customer_id='{$customerid}', orderdate='{$orderdate}', number='{$number}', filelink='{$fileid}' WHERE id='{$edit}'";
    } else {
        // добавление
        $sql = "INSERT INTO orders (customer_id,orderdate,number,filelink) VALUES ('{$customerid}','{$orderdate}','{$number}','{$fileid}')";
    }
    sql::query($sql);
    // если все нормально закрываем диалог и обновляем
    $form->processed("\$('#dialog').dialog('close');selectmenu('{$processing_type}','');");
} else {
    foreach ($form->errors as $err) {
        $form->alert(print_r($err, true));
예제 #7
0
	<?php 
$no = $row_perpage * ($page - 1) + 1;
while ($row = mysql_fetch_array($rs)) {
    $tgl = date("d-M-Y", strtotime($row['tanggal']));
    $tgl_terima = date("d-M-Y", strtotime($row['tanggal_diterima']));
    $tgl_selesai = date("d-M-Y", strtotime($row['tanggal_distribusi']));
    if ($no % 2 == 0) {
        $bg = "#C8C8C8";
    } else {
        $bg = "#CCCCCC";
    }
    echo "<tr bgcolor={$bg}><td align=\"center\">{$no}</td><td align=\"center\">{$tgl}</td><td >" . getJenis($row[2]) . "</td><td align=\"center\">{$row['3']}</td><td>{$row['4']}</td>";
    ?>
		
		<td align="center"><a target='_blank' href="download.php?id=<?php 
    echo getFileId($row[0]);
    ?>
"><img border=0 src="images/doc.gif"
</a></td>
<td align="center"><a href="index.php?_mod=peraturan&task=edit_peraturan&id=<?php 
    echo $row[0];
    ?>
">Edit |</a><a href="index.php?_mod=peraturan&task=delete_peraturan&id=<?php 
    echo $row[0];
    ?>
" onclick="return confirm('Are you sure you want to delete Peraturan No <?php 
    echo $row['no_peraturan'];
    ?>
 ?')">Delete</a></td></tr>	
		<?php 
    $no++;
예제 #8
0
파일: TV_YOUKU.php 프로젝트: guiduan/rpv
function GetVideo_FLASH($key, $hdstyle)
{
    $banben = date('Y-m-d');
    //	插件名字
    $video['name'] = "☆解析插件-优酷系统☆-" . $banben;
    $proxy = array('Address' => '', 'PORT' => '', 'USER' => '', 'PWD' => '');
    if (Region == 1 && empty($proxy['Address'])) {
        return false;
    }
    $hdstr = array(0 => "flv", 1 => "mp4", 2 => "hd2", 3 => "hd3");
    $video['Nowhds'] = $hdstyle >= 0 && $hdstyle < 4 ? $hdstyle : 3;
    for ($i = 0; $i < 3; $i++) {
        $info = getfile('http://v.youku.com/player/getPlayList/VideoIDS/' . $key . '/Pf/4/ctype/12/ev/1', 'http://v.youku.com', $proxy);
        if (!empty($info)) {
            break;
        }
    }
    $json = json_decode($info);
    $data = $json->data[0];
    for ($i = 0; $i < 3; $i++) {
        $info2 = getfile('http://v.youku.com/player/getPlayList/VideoIDS/' . $key . '/timezone/+08/version/5/source/video?ev=1&n=3&ctype=10&ran=985', 'http://v.youku.com', $proxy);
        if (!empty($info2)) {
            break;
        }
    }
    $json2 = json_decode($info2);
    $data2 = $json2->data[0];
    if (!empty($data->title)) {
        $video['subject'] = $data->title;
    }
    $mhds = 0;
    foreach ($data2->streamtypes as $val) {
        for ($i = 0; $i < count($hdstr); $i++) {
            if ($val == $hdstr[$i]) {
                $mhds++;
            }
            if ($mhds > 4) {
                break;
            }
        }
    }
    $video['mixhds'] = isset($mhds) ? $mhds : null;
    $video['Nowhds'] = min($video['mixhds'] - 1, $video['Nowhds']);
    $ep = $data->ep;
    list($user_sid, $user_token) = explode('_', Encode("becaf9be", confuse($ep)));
    if ($video['Nowhds'] == 3) {
        @($fid = cg_huns($data2->seed, $data2->streamfileids->{$hdstr}[$video['Nowhds']]));
    } else {
        @($fid = cg_huns($data->seed, $data->streamfileids->{$hdstr}[$video['Nowhds']]));
    }
    $type = $hdstr[$video['Nowhds']];
    $video['bytes'] = $data2->streamsizes->{$hdstr}[$video['Nowhds']];
    $video['duration'] = $data2->seconds;
    $seg = $data2->segs->{$hdstr}[$video['Nowhds']];
    if (!empty($seg)) {
        $i = 0;
        foreach ($seg as $value) {
            $value->no = dechex($value->no);
            if (1 == strlen($value->no)) {
                $value->no = '0' . $value->no;
            }
            $fileId = getFileId($fid, $value->no);
            $video['data'][$i]['src'] = getVideoSrc($value, $data, $type, $fileId, $user_sid, $user_token);
            if (!empty($value->seconds)) {
                $video['data'][$i]['duration'] = $value->seconds;
            }
            if (!empty($value->size)) {
                $video['data'][$i]['bytes'] = $value->size;
            }
            $i++;
        }
    }
    if (empty($video['data'][0]['src'])) {
        return false;
    }
    return $video;
}
예제 #9
0
function startElement($parser, $name, $attrs)
{
    global $id, $file, $emptypathid, $xrai_db, $db_filestatus, $db_pools, $poolid, $poolstate, $userid, $poolname;
    if ($name == "pool") {
        $id = $attrs["topic"];
        if (!$id) {
            die("No topic id defined!\n");
        }
        global $skipdone;
        if ($skipdone) {
            $res = $xrai_db->getOne("SELECT count(*) FROM {$db_pools} WHERE idtopic=? AND login=?", array($id, $userid));
            if (DB::isError($res)) {
                print "Error while reading pool state: " . dbMessage($res) . "\n";
                exit(1);
            }
            if ($res > 0) {
                print "Skipping since there is already {$res} pool(s) corresponding to {$userid}/{$id}\n";
                exit(0);
            }
        }
        if (!$poolid) {
            $poolid = $xrai_db->nextId("{$db_pools}_id");
            if (DB::isError($poolid)) {
                die($poolid->getUserInfo() . "\n");
            }
            $res = $xrai_db->autoExecute("{$db_pools}", array("id" => $poolid, "idtopic" => $id, "login" => $userid, "name" => $poolname, "state" => $poolstate, "enabled" => "t"));
            if (DB::isError($res)) {
                die($res->getUserInfo() . "\n");
            }
            print "Info: pool id is {$poolid}\n";
        }
        return;
    }
    if (!$id) {
        die("No topic id defined!\n");
    }
    switch ($name) {
        case "file":
            $file = getFileId($attrs["file"]);
            if ($file > 0) {
                $res = $xrai_db->getOne("SELECT count(*) FROM {$db_filestatus} WHERE idfile=? AND idpool=?", array($file, $poolid));
                if (DB::isError($res)) {
                    die($res->getUserInfo() . "\n");
                }
                if ($res > 0) {
                    print "/!\\ Skipping {$file} ({$attrs['file']})\n";
                    break;
                }
                print "Adding {$file} ({$attrs['file']})\n";
                $res = $xrai_db->autoExecute($db_filestatus, array("idfile" => $file, "idpool" => $poolid, "status" => "0", "inpool" => "t", "version" => 1, "bep" => $emptypathid));
                if (DB::isError($res)) {
                    die($res->getUserInfo() . "\n");
                }
            }
            break;
        case "path":
        case "passage":
            break;
        default:
            die("Unexpected tag: {$name}");
    }
}
예제 #10
0
<?php

function getFileId($peraturan_id)
{
    $sql = "select file_id from file_dokumen where peraturan_id={$peraturan_id}";
    $res = mysql_query($sql);
    if ($row = mysql_fetch_array($res)) {
        return $row[0];
    } else {
        return "#NA";
    }
}
$id = $_REQUEST["id"];
$sql = "delete from peraturan where peraturan_id={$id}";
$result = mysql_query($sql);
$file_id = getFileId($id);
$sql_file = "select path from file_dokumen where peraturan_id={$file_id}";
if ($row = mysql_fetch_array($sql_file)) {
    $path = $row[0];
    unlink($path);
}
$sql = "delete from file_dokumen where file_id={$file_id}";
$result = mysql_query($sql);
if ($result) {
    ?>
      <SCRIPT language="JavaScript">
      alert('Delete Succes!');
      </SCRIPT> <?php 
    header("Location: index.php?_mod=peraturan&task=admin_peraturan&act=new");
} else {
    ?>